public abstract class AbstractGeneratedKeysQuery
extends java.lang.Object
Constructor and Description |
---|
AbstractGeneratedKeysQuery(java.lang.String sql,
int autoGeneratedKeys)
Process SQL statement text according to autoGeneratedKeys value.
|
AbstractGeneratedKeysQuery(java.lang.String sql,
int[] columnIndexes)
Process SQL statement for adding generated key columns by their ordinal
position.
|
AbstractGeneratedKeysQuery(java.lang.String sql,
java.lang.String[] columnNames)
Process SQL statement for adding generated key columns by name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
generatesKeys()
Indicates if the query will generate keys.
|
java.lang.String |
getQueryString()
Returns the actual query.
|
static boolean |
isGeneratedKeysSupportLoaded()
Indicates if generated keys support has been loaded and available for use.
|
public AbstractGeneratedKeysQuery(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
For Statement.NO_GENERATED_KEYS the statement will not be processed, for Statement.RETURN_GENERATED_KEYS it will be processed.
The query will only be modified if 1) it is capable of returning keys (ie INSERT, DELETE and UPDATE) and 2) does not already contain a RETURNING clause.
sql
- SQL statementautoGeneratedKeys
- Valid values Statement.NO_GENERATED_KEYS
and
Statement.RETURN_GENERATED_KEYS
java.sql.SQLException
- If the supplied autoGeneratedKeys value does not match valid
values or if the parser cannot be loaded when autoGeneratedKeys = RETURN_GENERATED_KEYS.public AbstractGeneratedKeysQuery(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
The query will only be modified if 1) it is capable of returning keys (ie INSERT, DELETE and UPDATE) and 2) does not already contain a RETURNING clause.
The columns are added in ascending order of their index value, not by the
order of indexes in the columnIndexes array. The values of columnIndexes
are taken as the ORDINAL_POSITION returned by
DatabaseMetaData.getColumns(String, String, String, String)
. When a column index does not exist for the table of the query, then it
will be discarded from the list silently.
sql
- SQL statementcolumnIndexes
- Array of ORDINAL_POSITION values of the columns to return as
generated keyjava.sql.SQLException
- If the parser cannot be loadedpublic AbstractGeneratedKeysQuery(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
The query will only be modified if 1) it is capable of returning keys (ie INSERT, DELETE and UPDATE) and 2) does not already contain a RETURNING clause.
The columnNames passed are taken as is and included in a new returning clause. There is no check for actual existence of these columns, nor are they quoted.
sql
- SQL statementcolumnNames
- Array of column names to return as generated keyjava.sql.SQLException
- If the parser cannot be loadedpublic boolean generatesKeys() throws java.sql.SQLException
true
if the query will generate keys,
false
otherwisejava.sql.SQLException
- For errors accessing the metadatapublic java.lang.String getQueryString() throws java.sql.SQLException
Use generatesKeys()
to see if this query will in fact generate
keys.
java.sql.SQLException
- For errors accessing the metadatapublic static boolean isGeneratedKeysSupportLoaded()
This method returns false
when the antlr-runtime is not on the classpath or the StatementParser
implementation could not be loaded for other reasons.
true
if generated keys can be used in the driver (assuming the Firebird version supports it)Copyright © 2001-2019 Jaybird (Firebird JDBC/JCA) team. All rights reserved.