You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bcfc004
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: src/docs/asciidoc/reference/statement/generatedkeys.adoc
+3-24Lines changed: 3 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,17 +16,6 @@ There are four distinct use-cases:
16
16
In this case all the previous cases are ignored and the query is executed as is.
17
17
It is possible to retrieve the result set using `getGeneratedKeys()`.
18
18
19
-
.ANTLR Runtime required in Jaybird 4.0.7 and earlier
20
-
****
21
-
For Jaybird 4.0.7 and earlier, the generated keys functionality will only be available if the ANTLR runtime classes are on the classpath.
22
-
Except for calling methods with `NO_GENERATED_KEYS`, absence of the ANTLR runtime will throw `FBDriverNotCapableException`.
23
-
24
-
TIP: The required ANTLR runtime version depends on the Jaybird version, check the release notes of your version for details.
25
-
26
-
Since Jaybird 4.0.8, Jaybird uses a custom parser and no longer requires ANTLR for the generated keys feature.
27
-
If you previously relied on absence of ANTLR to disable generated keys support, the generated keys feature can be disabled by setting <<ref-generatedkeys-config,connection property `generatedKeysEnabled`>> to `disabled`.
28
-
****
29
-
30
19
This functionality is available for `INSERT`, `UPDATE`, `UPDATE OR INSERT`, `DELETE`, and `MERGE`.
31
20
32
21
Generated keys retrieval modifies the statement to add a `RETURNING`-clause.
@@ -149,11 +138,9 @@ The values in the `int[]` parameter are the ordinal positions of the columns as
149
138
150
139
[WARNING]
151
140
====
152
-
In Jaybird 3 and earlier, a null or empty array was silently ignored and the statement was executed normally (not producing generated keys).
153
-
In Jaybird 4, this behaviour has changed and instead will throw an exception with message "`__Generated keys array columnIndexes was empty or null. A non-empty array is required.__`"
141
+
Passing a null or empty array will throw an exception with message "`__Generated keys array columnIndexes was empty or null. A non-empty array is required.__`"
154
142
155
-
In Jaybird 3 and earlier, invalid ordinal positions are ignored and silently dropped: passing `new int[] { 1, 5, 6 }` will work, even if there is no sixth column.
156
-
Since Jaybird 4, this behavior has changed and instead will throw an exception with message "`__Generated keys column position <position> does not exist for table <tablename>. Check DatabaseMetaData.getColumns (column ORDINAL_POSITION) for valid values.__`"
143
+
Passing invalid ordinal positions will throw an exception with message "`__Generated keys column position <position> does not exist for table <tablename>. Check DatabaseMetaData.getColumns (column ORDINAL_POSITION) for valid values.__`"
Notice that the index used for retrieval does not match the column position in the table (5) passed in the prepare.
199
186
As this is the second column in the result set, it is retrieved from the result set by `2`.
200
187
201
-
[WARNING]
202
-
====
203
-
In Jaybird 3 and earlier, the array of indices is sorted in ascending order before use: passing `new int[] { 4, 1, 3 }` will yield columns in order `ID`, `LASTNAME`, `BIRTHDATE`.
204
-
Since Jaybird 4, this sort is no longer applied, so columns will be in the order specified by the array: `BIRTHDATE`, `ID`, `LASTNAME`.
205
-
To avoid issues, we recommend specifying the columns in ascending order, or always retrieve them by name.
206
-
====
207
-
208
188
[[ref-generatedkeys-column-name]]
209
189
==== Generated keys by column name
210
190
@@ -222,8 +202,7 @@ This method is the fastest as it does not retrieve metadata from the server.
222
202
223
203
[WARNING]
224
204
====
225
-
In Jaybird 3 and earlier, a null or empty array was silently ignored and the statement was executed normally (not producing generated keys).
226
-
Since Jaybird 4, this behaviour has changed and instead will throw an exception with message "`__Generated keys array columnNames was empty or null. A non-empty array is required.__`"
205
+
Passing a null or empty array will throw an exception with message "`__Generated keys array columnNames was empty or null. A non-empty array is required.__`"
0 commit comments