|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectcom.ibm.pdq.runtime.generator.BaseData
public class BaseData
| Data Type | Field Name and Description |
|---|---|
static int |
MULTI_ROW_PARAMETERS |
static int |
MULTI_ROW_RESULT |
static int |
NO_PARAMETERS |
static int |
SINGLE_ROW_PARAMETERS |
static int |
SINGLE_ROW_RESULT |
| Constructor and Description | |
|---|---|
BaseData() |
|
| Return Data Type | Method Name and Description | |
|---|---|---|
|
call(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,?,? extends CAL> handlerContainer, Object... parameters) |
|
|
call(com.ibm.pdq.runtime.statement.StatementDescriptor
statementDescriptor, Object... parameters) |
|
|
call(String sql, CallHandler<CAL> callHandler, Object... parameters)Executes the given sql as a stored procedure call and returns an object of type <CAL> that indicates the results of the stored procedure
call. |
|
|
call(String sql, CallHandlerWithParameters<CAL> callHandler, Object... parameters)Executes the given sql as a stored procedure call and returns an object of type <CAL> that indicates the results of the stored procedure
call. |
|
StoredProcedureResult |
call(String sql, Object... parameters)Executes the given sql stored procedure call and returns an instance of StoredProcedureResult that represents the results of executing the sql. |
|
void |
checkCompatibleRuntimeVersion(String generatorVersion) |
|
void |
close()Frees all resources and closes the associated instance of Connection by calling Connection.close() for that instance. |
|
void |
commit()Delegates a commit request ( Connection.commit()) to the associated instance of Connection. |
|
static com.ibm.pdq.runtime.statement.StatementDescriptor |
createStatementDescriptor(String
methodNameAndParameterTypesString, String dynamicSql, int[]
statementAttributes, com.ibm.pdq.runtime.statement.SqlStatementType sqlStatementType, String[] autoGeneratedColumnNames, ParameterHandler parameterHandler, int[][] parameterMetaData, ResultHandler resultHandler, RowHandler rowHandler, int[][] resultSetMetaData, CallHandlerWithParameters callHandler, String interfaceName, long generationTime, String collection, int methodIndex) |
|
static com.ibm.pdq.runtime.statement.StatementDescriptor |
createStatementDescriptor(String
methodNameAndParameterTypesString, String dynamicSql, int[]
statementAttributes, com.ibm.pdq.runtime.statement.SqlStatementType sqlStatementType, String[] autoGeneratedColumnNames, ParameterHandler parameterHandler, int[][] parameterMetaData, RowHandler rowHandler, int[][] resultSetMetaData, CallHandlerWithParameters callHandler, String interfaceName, long generationTime, String collection, int methodIndex) |
|
static com.ibm.pdq.runtime.statement.StatementDescriptor |
createStatementDescriptor(String
methodNameAndParameterTypesString, String dynamicSql, int[]
statementAttributes, com.ibm.pdq.runtime.statement.SqlStatementType sqlStatementType, String[] autoGeneratedColumnNames, ParameterHandler parameterHandler, int[][] parameterMetaData, RowHandler rowHandler, int[][] resultSetMetaData, CallHandlerWithParameters callHandler, String interfaceName, String
collection, long generationTime, int methodIndex) |
|
static com.ibm.pdq.runtime.statement.StatementDescriptor |
createStatementDescriptor(String
methodNameAndParameterTypesString, String dynamicSql,
com.ibm.pdq.runtime.statement.SqlStatementType sqlStatementType, String[] autoGeneratedColumnNames, com.ibm.pdq.runtime.generator.ParameterHandler parameterHandler, int[][] parameterMetaData, RowHandler rowHandler, int[][] resultSetMetaData, CallHandler callHandler, String interfaceName, String collection, long generationTime, int methodIndex) |
|
static com.ibm.pdq.runtime.statement.StatementDescriptor |
createStatementDescriptor(String
methodNameAndParameterTypesString, String dynamicSql,
com.ibm.pdq.runtime.statement.SqlStatementType sqlStatementType, String[] autoGeneratedColumnNames, com.ibm.pdq.runtime.generator.ParameterHandler parameterHandler, int[][] parameterMetaData, RowHandler rowHandler, int[][] resultSetMetaData, String interfaceName, String collection, long generationTime, int methodIndex) |
|
int[][] |
endBatch()Executes the INSERT, UPDATE, and DELETE SQL statements that have been queued for a heterogeneous update with parameters and returns an int[][] that describes the
results of the execution. |
|
boolean |
getAutoCommit()Returns a boolean that indicates whether auto-commit mode is enabled for the associated instance of Connection. |
|
HeterogeneousBatchKind |
getBatchKind()Returns a value of HeterogeneousBatchKind, which
indicates that SQL statements are being executed immediately, or that a batch for a heterogeneous update with parameters is being created. |
|
Connection |
getConnection()Returns the Connection object that is
associated with the instance of Data, if such an object exists. |
|
Data |
getData() |
|
String |
getGeneratorVersion() |
|
com.ibm.pdq.runtime.internal.trace.DataLogger |
getLogger()Returns the instance of DataLogger to use for all of the logging that occurrs in association with the instance of Data. |
|
com.ibm.pdq.runtime.statement.StatementDescriptor |
getStatementDescriptor(String methodNameAndParameterTypesString) |
|
com.ibm.pdq.runtime.statement.StatementDescriptor |
getStatementDescriptor(String
methodNameAndParameterTypesString, String dynamicSql,
com.ibm.pdq.runtime.statement.SqlStatementType sqlStatementType, int section, Object[] generatorMetaData) |
|
|
query(int
type, int concurrency, int holdability, String sql, ResultHandler<RES> handler, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns an Object of type
<RES> that indicates the results of the statement. |
|
|
query(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<? extends RES,?,?> handlerContainer,
Object... parameters) |
|
|
query(com.ibm.pdq.runtime.statement.StatementDescriptor
statementDescriptor, Object... parameters) |
|
|
query(String sql, ResultHandler<RES> handler, Object... parameters)Executes the given sql statement (with parameters that provide the parameters to sql) and returns an Object of type
<RES> that indicates the query results of the statement. |
|
|
queryArray(com.ibm.pdq.runtime.statement.StatementDescriptor
statementDescriptor, Class<ROW> returnClass, Object... parameters) |
|
|
queryArray(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer,
Class<ROW> returnClass, Object... parameters) |
|
|
queryArray(String sql, Class<ROW> returnClass, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns an array such that each element in the array
contains the contents of a row of the query results in a pureQuery bean that is an instance of the class <ROW>. |
|
|
queryArray(String sql, Class<ROW>
returnClass, RowHandler<ROW> rowHandler, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns an array such that each element in the array
contains the contents of a row of the query results in an instance of the class <ROW>. |
|
Map<String,Object>[] |
queryArray(String sql, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns an array such that each element in the array
contains the contents of a row of the query results in a Map. |
|
|
queryArray(String sql, RowHandler<ROW> rowHandler, Object... parameters)Deprecated. |
|
|
queryFirst(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer,
Object... parameters) |
|
|
queryFirst(com.ibm.pdq.runtime.statement.StatementDescriptor
statementDescriptor, Object... parameters) |
|
|
queryFirst(String sql, Class<ROW> returnClass, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns the contents of the first row of
the query results in a pureQuery bean that is an instance of the class <ROW>. |
|
Map<String,Object> |
queryFirst(String sql, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns a Map that represents the first row of the results that is
returned from executing the sql statement. |
|
|
queryFirst(String sql, RowHandler<ROW> rowHandler, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns the contents of the first row
of the query results in an instance of the class <ROW>. |
|
|
queryIterator(int
type, int concurrency, int holdability, String sql, Class<ROW> returnClass, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns an Iterator instance such that each call to the Iterator.next() method of the Iterator
instance provides the contents of a row of the query results in a pureQuery bean that is an instance of the class <ROW>. |
|
Iterator<Map<String,Object>> |
queryIterator(int type, int
concurrency, int holdability, String sql, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns an Iterator instance such that each call to the Iterator.next() method of the instance provides the
contents of a row of the query results in a Map. |
|
|
queryIterator(int
type, int concurrency, int holdability, String sql, RowHandler<ROW> rowHandler, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns an Iterator instance such that each call to the Iterator.next() method of the Iterator
instance provides the contents of a row of the query results in an instance of the class <ROW>. |
|
|
queryIterator(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer,
Object... parameters) |
|
|
queryIterator(com.ibm.pdq.runtime.statement.StatementDescriptor
statementDescriptor, Object... parameters) |
|
|
queryIterator(String sql, Class<ROW> returnClass, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns an Iterator instance such that each call to the Iterator.next() method of the Iterator
instance provides the contents of a row of the query results in a pureQuery bean that is an instance of the class <ROW>. |
|
Iterator<Map<String,Object>> |
queryIterator(String sql, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns an Iterator instance such that each call to the Iterator.next() method of the instance provides the
contents of a row of the query results in a Map. |
|
|
queryIterator(String sql, RowHandler<ROW> rowHandler, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns an Iterator instance such that each call to the Iterator.next() method of the Iterator
instance provides the contents of a row of the query results in an instance of the class <ROW>. |
|
|
queryList(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer,
Object... parameters) |
|
|
queryList(com.ibm.pdq.runtime.statement.StatementDescriptor
statementDescriptor, Object... parameters) |
|
|
queryList(String sql, Class<ROW>
returnClass, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns a List instance such that each element in the List
instance contains the contents of a row of the query results in a pureQuery bean that is an instance of the class <ROW>. |
|
List<Map<String,Object>> |
queryList(String sql, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns a List instance such that each element in the List
instance contains the contents of a row of the query results in a Map. |
|
|
queryList(String sql, RowHandler<ROW> rowHandler, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns a List instance such that each element in the List
instance contains the contents of a row of the query results in an instance of the class <ROW>. |
|
ResultSet |
queryResults(int type, int
concurrency, int holdability, String sql, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns the contents of the query results in an
instance of ResultSet. |
|
ResultSet |
queryResults(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer, Object... parameters) |
|
ResultSet |
queryResults(com.ibm.pdq.runtime.statement.StatementDescriptor
statementDescriptor, Object... parameters) |
|
ResultSet |
queryResults(String sql, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns the contents of the query results in an
instance of ResultSet. |
|
void |
rollback()Delegates a rollback request Connection.rollback() to the associated instance of Connection. |
|
void |
setAutoCommit(boolean autoCommit)Sets whether auto-commit mode is enabled for the associated instance of Connection by calling Connection.setAutoCommit(boolean) for the Connection instance. |
|
void |
setData(Data data) |
|
void |
setLogger(com.ibm.pdq.runtime.internal.trace.DataLogger
logger) |
|
void |
startBatch(HeterogeneousBatchKind batchKind)Starts a batch for a heterogeneous update with parameters. |
|
static
|
testNull(T obj, boolean isNull) |
|
|
update(ROW returnClass, com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?>
handlerContainer, Object... parameters) |
|
|
update(ROW returnClass,
com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, Object... parameters) |
|
int |
update(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer, Object... parameters) |
|
int |
update(com.ibm.pdq.runtime.statement.StatementDescriptor
statementDescriptor, Object... parameters) |
|
|
update(String sql, Class<T> returnClass, String[] columnNames, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns an autogenerated key, if one was generated,
for one or all of the columns that are specified in columnNames, and possibly returns the update count as well. |
|
int |
update(String sql, Object... parameters)Executes the given sql statement (with parameters that provide parameters to sql) and returns an int that indicaties how many
rows in the data source are updated. |
|
|
updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer, Iterable<T> parameters) |
|
|
updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer, Iterator<T> parameters) |
|
|
updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor
statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer, T[] parameters) |
|
|
updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor
statementDescriptor, Iterable<T> parameters) |
|
|
updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor
statementDescriptor, Iterator<T> parameters) |
|
|
updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor
statementDescriptor, T[] parameters) |
|
int[] |
updateMany(String... heterogeneousBatchSQL)Executes the multiple SQL strings given in one round trip to the server (or in a batch, if the JDBC driver supports one round trip processing). |
|
|
updateMany(String sql, Iterable<T> parameters)Executes the given sql statement once for each element in parameters (with parameters that provide parameters to sql for each
execution) and returns an int[] in which each element in the int[] indicates the update count (that is, the number of rows that were updated) for the
corresponding execution of the sql statement. |
|
|
updateMany(String sql, Iterator<T> parameters)Executes the given sql statement once for each element in parameters (with parameters that provide parameters to sql for each
execution) and returns an int[] in which each element in the int[] indicates the update count (that is, the number of rows that were updated) for the
corresponding execution of the sql statement. |
|
|
updateMany(String sql, T[] parameters)Executes the given sql statement once for each element in parameters (with parameters that provide parameters to sql for each
execution) and returns an int[] in which each element in the int[] indicates the update count (that is, the number of rows that were updated) for the
corresponding execution of the sql statement. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
|---|
public static final int MULTI_ROW_PARAMETERS
public static final int MULTI_ROW_RESULT
public static final int NO_PARAMETERS
public static final int SINGLE_ROW_PARAMETERS
public static final int SINGLE_ROW_RESULT
Constructor Detail |
|---|
public BaseData()
Method Detail |
|---|
public <CAL> CAL call(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
com.ibm.pdq.runtime.generator.HandlerContainer<?,?,? extends CAL> handlerContainer,
Object... parameters)
call in interface com.ibm.pdq.runtime.generator.GeneratorData
public <CAL> CAL call(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
Object... parameters)
call in interface com.ibm.pdq.runtime.generator.GeneratorData
public <CAL> CAL call(String sql,
CallHandler<CAL> callHandler,
Object... parameters)
Datasql as a stored procedure call and returns an object of type <CAL> that indicates the results of the stored procedure call. The actual
processing of the results of the stored procedure call is done by the callHandler, and the object that is returned is the object that is returned by callHandler.handleCall(CallableStatement)
Attention: It is recommended that Data.call(String,
CallHandlerWithParameters, Object...) be used instead of this method (call(String, CallHandler, Object...)).
The generic return type <CAL> is indicated by the type of the CallHandler<CAL>, and it can be any of the following types:
call in interface
DataCAL - the generic type of the object to return. <CAL> is indicated by the generic type of callHandler.sql - the SQL string to executecallHandler - an instance of an implementation of the CallHandlerparameters - used when executing the sql. The parameters are not passed to the callHandler, and the values of the OUT
and INOUT parameters are not updated. If this is wanted, Data.call(String,
CallHandlerWithParameters, Object...) must be used instead of this method.CallHandlerData.call(String,
CallHandlerWithParameters, Object...), CallHandler
public <CAL> CAL call(String sql,
CallHandlerWithParameters<CAL> callHandler,
Object... parameters)
Datasql as a stored procedure call and returns an object of type <CAL> that indicates the results of the stored procedure call. The actual
processing of the results of the stored procedure call is done by the callHandlerWithParameters, and the object that is returned is the object that is returned by callHandlerWithParameters.handleCall(CallableStatement,
Object...)
The generic return type <CAL> is indicated by the type of the CallHandlerWithParameters<CAL>, and it can be any of the following types:
call in interface
DataCAL - the generic type of the object to return. <CAL> is indicated by the generic type of callHandlerWithParameters.sql - the SQL string to executecallHandler - an instance of an implementation of the CallHandlerWithParametersparameters - used as the parameters to the sql. The parameters are also passed as parameters to handleCall(CallableStatement,
Object...). The parameters can include IN, OUT, and INOUT parameters. pureQuery updates the values of the OUT and INOUT parameters if
callHandlerWithParameters updates the values. Updateable parameters must be mutable; for example, they cannot be String or Integer objects.CallHandlerWithParametersCallHandlerWithParameters
public StoredProcedureResult call(String sql,
Object... parameters)
Datasql stored procedure call and returns an instance of StoredProcedureResult that represents the results of executing the sql. The returned StoredProcedureResult
instance contains information such as the returned query results and an Object[] that contains the user's parameters.
parameters contains the parameters for the SQL stored procedure call. Certain passed-in parameters are updated with the values that are assigned to the corresponding SQL
parameters during the execution of the call. To be updated, a passed-in parameter must meet both of the following conditions:
Map or a pureQuery
bean.However, the updated values of all the OUT and INOUT parameters of the called stored procedure can be obtained by calling StoredProcedureResult.getOutputParms().
call in interface Datasql - the SQL string to executeparameters - used as the parameters to the sql. The parameters can include IN, OUT, and INOUT parameters. The values of the OUT and INOUT
parameters that are Maps and pureQuery beans are updated
with the values that are set during the called stored procedure. The updated values of all of the OUT and INOUT parameters to the stored procedure call can be obtained by
calling StoredProcedureResult.getOutputParms().StoredProcedureResult that
represents the results of executing the sql stored procedure callStoredProcedureResult
public void checkCompatibleRuntimeVersion(String generatorVersion)
throws DataRuntimeException
DataRuntimeExceptionpublic void close()
DataConnection by calling Connection.close() for that instance.close in interface DataConnection.close()public void commit()
DataConnection.commit()) to the associated instance of Connection.commit in interface DataConnection, Connection.commit()
public static com.ibm.pdq.runtime.statement.StatementDescriptor createStatementDescriptor(String methodNameAndParameterTypesString,
String dynamicSql,
int[] statementAttributes,
com.ibm.pdq.runtime.statement.SqlStatementType sqlStatementType,
String[] autoGeneratedColumnNames,
ParameterHandler parameterHandler,
int[][] parameterMetaData,
ResultHandler resultHandler,
RowHandler rowHandler,
int[][] resultSetMetaData,
CallHandlerWithParameters callHandler,
String interfaceName,
long generationTime,
String collection,
int methodIndex)
public static com.ibm.pdq.runtime.statement.StatementDescriptor createStatementDescriptor(String methodNameAndParameterTypesString,
String dynamicSql,
int[] statementAttributes,
com.ibm.pdq.runtime.statement.SqlStatementType sqlStatementType,
String[] autoGeneratedColumnNames,
ParameterHandler parameterHandler,
int[][] parameterMetaData,
RowHandler rowHandler,
int[][] resultSetMetaData,
CallHandlerWithParameters callHandler,
String interfaceName,
long generationTime,
String collection,
int methodIndex)
public static com.ibm.pdq.runtime.statement.StatementDescriptor createStatementDescriptor(String methodNameAndParameterTypesString,
String dynamicSql,
int[] statementAttributes,
com.ibm.pdq.runtime.statement.SqlStatementType sqlStatementType,
String[] autoGeneratedColumnNames,
ParameterHandler parameterHandler,
int[][] parameterMetaData,
RowHandler rowHandler,
int[][] resultSetMetaData,
CallHandlerWithParameters callHandler,
String interfaceName,
String collection,
long generationTime,
int methodIndex)
public static com.ibm.pdq.runtime.statement.StatementDescriptor createStatementDescriptor(String methodNameAndParameterTypesString,
String dynamicSql,
com.ibm.pdq.runtime.statement.SqlStatementType sqlStatementType,
String[] autoGeneratedColumnNames,
com.ibm.pdq.runtime.generator.ParameterHandler parameterHandler,
int[][] parameterMetaData,
RowHandler rowHandler,
int[][] resultSetMetaData,
CallHandler callHandler,
String interfaceName,
String collection,
long generationTime,
int methodIndex)
public static com.ibm.pdq.runtime.statement.StatementDescriptor createStatementDescriptor(String methodNameAndParameterTypesString,
String dynamicSql,
com.ibm.pdq.runtime.statement.SqlStatementType sqlStatementType,
String[] autoGeneratedColumnNames,
com.ibm.pdq.runtime.generator.ParameterHandler parameterHandler,
int[][] parameterMetaData,
RowHandler rowHandler,
int[][] resultSetMetaData,
String interfaceName,
String collection,
long generationTime,
int methodIndex)
public int[][] endBatch()
Dataint[][] that describes the results of
the execution. After this method is called, the database connection resumes executing SQL statements immediately, instead of queueing them in a batch.
pureQuery performs heterogeneous updates with parameters by queueing INSERT, UPDATE, and DELETE SQL statements in memory for a particular instance of Data, and then
executing the queued statements in one network trip. The implementation classes that the pureQuery Generator creates for user-supplied interfaces of annotated methods implement the
user-provided interfaces, as well as the Data interface. See the IBM Data Studio pureQuery Runtime documentation for an explaination of how to perform heterogeneous batches
with parameters when using the annotated-method programming style.
Calling data.startBatch
(HeterogeneousBatchKind.heterogeneousModify__) starts a batch for a heterogeneous update with parameters for the instance of Data. INSERT, UPDATE, and DELETE SQL
statement are then queued in the batch by calling pureQuery annotated and inline methods in the instance of Data. If an attempt is made to add SQL statements other than
INSERT, UPDATE, and DELETE to the batch (by calling methods that excute SQL statements that are not INSERT, UPDATE, or DELETE), an exception is thrown, the current batch is cleared, and
none of the SQL statements are executed. When all of the necessary SQL statements have been added to the batch, the batch can be executed by calling data.endBatch().
Heterogeneous updates with parameters use functionality that is unique to DB2 and the IBM DB2 Universal JDBC Driver. An exception is thrown if
startBatch(HeterogeneousBatchKind) or endBatch() is called with any other database or database driver.
endBatch in interface Dataint array of arrays that describes the results of executing the heterogeneous update with parameters. This is an array of the int[]s that are returned
from executing each SQL statement that was added to the batch. These int[]s follow the format that is used for the return value of Statement.executeBatch(), which is the format
that is used by pureQuery to return the results of homogeneous batches. If an UpdateManyException is thrown, then the int[][] of updates can be retrieved by calling UpdateManyException.getHeterogeneousUpdateCounts() on the
exception.Data.startBatch(HeterogeneousBatchKind), Data.getBatchKind(), UpdateManyException, HeterogeneousBatchKindpublic boolean getAutoCommit()
Databoolean that indicates whether auto-commit mode is enabled for the associated instance of Connection. If true is returned, auto-commit mode is currently enabled, and if false is returned, auto-commit
mode is currently disabled. The return value is found by calling Connection.getAutoCommit() for the associated instance of Connection.getAutoCommit in interface Databoolean that indicates whether auto-commit mode is enabled for the associated instance of Connection. If true is returned, auto-commit mode is currently enabled, and if false is returned,
auto-commit mode is currently disabled. The return value is found by calling Connection.getAutoCommit() for the associated instance of Connection.Connection, Connection.getAutoCommit()public HeterogeneousBatchKind getBatchKind()
DataHeterogeneousBatchKind, which indicates
that SQL statements are being executed immediately, or that a batch for a heterogeneous update with parameters is being created.getBatchKind in interface DataHeterogeneousBatchKind, which indicates
that SQL statements are being executed immediately, or that a batch for a heterogeneous update with parameters is being created.Data.endBatch(), Data.startBatch(HeterogeneousBatchKind), HeterogeneousBatchKindpublic Connection getConnection()
DataConnection object that is associated with
the instance of Data, if such an object exists. A RuntimeException is thrown if no such Connection object is associated with the instance of Data.getConnection in interface DataConnection object that is associated with
the instance of Data, if such an object exists. A RuntimeException is thrown if no such Connection object is associated with the instance of Data.Connectionpublic Data getData()
getData in interface com.ibm.pdq.runtime.generator.GeneratorDatapublic String getGeneratorVersion()
public com.ibm.pdq.runtime.internal.trace.DataLogger getLogger()
DataDataLogger to use for all of the logging that occurrs in association with the instance of Data.getLogger in interface DataDataLogger to use for all of the logging that occurrs in association with the instance of Datapublic com.ibm.pdq.runtime.statement.StatementDescriptor getStatementDescriptor(String methodNameAndParameterTypesString)
getStatementDescriptor in interface com.ibm.pdq.runtime.generator.DataWrapper
public com.ibm.pdq.runtime.statement.StatementDescriptor getStatementDescriptor(String methodNameAndParameterTypesString,
String dynamicSql,
com.ibm.pdq.runtime.statement.SqlStatementType sqlStatementType,
int section,
Object[] generatorMetaData)
public <RES> RES query(int type,
int concurrency,
int holdability,
String sql,
ResultHandler<RES> handler,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns an Object of type
<RES> that indicates the results of the statement. The actual processing of the results of the statement is done by the handler, and the Object
that is returned is the Object that is returned by handler.handle(ResultSet).query in
interface DataRES - the generic type of the Object to return. <RES> is indicated by the generic type of handler.type - the type runtime attribute for query processing. Supported values are: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, and
ResultSet.TYPE_SCROLL_INSENSITIVE.concurrency - the concurrency runtime attribute for query processing. Supported values are: ResultSet.CONCUR_READ_ONLY and ResultSet.CONCUR_UPDATABLE.holdability - the holdability runtime attribute for query processing. Supported values are: ResultSet.CLOSE_CURSORS_AT_COMMIT and
ResultSet.HOLD_CURSORS_OVER_COMMIT.sql - the SQL string to executehandler - the ResultHandler whose handler.handle(ResultSet) method processes the results that are produced
by executing the sql statement and returns some or all of the query results in an Object of type <RES>. The Object that is
returned by this method (Data.query(String, ResultHandler,
Object...)) is the Object that is returned by handle(ResultSet).parameters - used as the parameters to the sql.Object of type <RES> that contains some or all of the contents of the results that are produced by executing the sql statement. The
returned Object is that which is returned by handler.handle(ResultSet).ResultHandler
public <RES> RES query(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
com.ibm.pdq.runtime.generator.HandlerContainer<? extends RES,?,?> handlerContainer,
Object... parameters)
query in interface com.ibm.pdq.runtime.generator.GeneratorData
public <RES> RES query(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
Object... parameters)
query in interface com.ibm.pdq.runtime.generator.GeneratorData
public <RES> RES query(String sql,
ResultHandler<RES> handler,
Object... parameters)
Datasql statement (with parameters that provide the parameters to sql) and returns an Object of type
<RES> that indicates the query results of the statement. The actual processing of the results of the statement is done by the handler, and the
Object returned is the Object returned by handler.handle(ResultSet).query in
interface DataRES - the generic type of the Object to return. <RES> is indicated by the generic type of handler.sql - the SQL string to executehandler - the ResultHandler whose handler.handle(ResultSet) method processes the results that are produced
by the execution of the sql statement and return some or all of the results in an Object of type <RES>. The Object returned
by this method (Data.query(String, ResultHandler,
Object...)) is the Object that is returned by handle(ResultSet).parameters - used as the parameters to the sql.Object of type <RES> that contains some or all of the contents of the results that are produced by executing the sql statement. The
returned Object is that which is returned by handler.handle(ResultSet).ResultHandler
public <ROW> ROW[] queryArray(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
Class<ROW> returnClass,
Object... parameters)
queryArray in interface com.ibm.pdq.runtime.generator.GeneratorData
public <ROW> ROW[] queryArray(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer,
Class<ROW> returnClass,
Object... parameters)
queryArray in interface com.ibm.pdq.runtime.generator.GeneratorData
public <ROW> ROW[] queryArray(String sql,
Class<ROW> returnClass,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns an array such that each element in the array contains
the contents of a row of the query results in a pureQuery bean that is an instance of the class <ROW>. See the IBM Data Studio pureQuery Runtime documentation for details
about how pureQuery maps query results to pureQuery beans.queryArray in interface
DataROW - the generic type of the array to return. <ROW> is indicated by the generic type of returnClass.sql - the SQL string to executereturnClass - used to represent each row of the results in the returned array. This parameter indicates the type that is represented by <ROW>.parameters - used as the parameters to the sql.<ROW>
public <ROW> ROW[] queryArray(String sql,
Class<ROW> returnClass,
RowHandler<ROW> rowHandler,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns an array such that each element in the array contains
the contents of a row of the query results in an instance of the class <ROW>. pureQuery uses singleRowHandler (specifically singleRowHandler.handle(ResultSet, Object)) to create each object of type
<ROW>.queryArray
in interface DataROW - the generic type of the array to return. <ROW> is indicated by the generic type of rowHandler.sql - the SQL string to executereturnClass - used to represent each row of the results in the returned array. This parameter indicates the type that is represented by <ROW>.rowHandler - The RowHandler
whose rowHandler.handle(ResultSet, Object) method maps the
contents of each row to an Object of type <ROW>parameters - used as the parameters to the sql.<ROW>
public Map<String,Object>[] queryArray(String sql,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns an array such that each element in the array contains
the contents of a row of the query results in a Map. The keys in
the Map are the labels of the columns from the row, and the values in the Map are the values that are stored in the particular columns of that row.queryArray in interface Datasql - the SQL string to executeparameters - used as the parameters to the sql.Map
@Deprecated
public <ROW> ROW[] queryArray(String sql,
RowHandler<ROW> rowHandler,
Object... parameters)
queryArray
in interface Data
public <ROW> ROW queryFirst(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer,
Object... parameters)
queryFirst in interface com.ibm.pdq.runtime.generator.GeneratorData
public <ROW> ROW queryFirst(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
Object... parameters)
queryFirst in interface com.ibm.pdq.runtime.generator.GeneratorData
public <ROW> ROW queryFirst(String sql,
Class<ROW> returnClass,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns the contents of the first row of the query
results in a pureQuery bean that is an instance of the class <ROW>. See the IBM Data Studio pureQuery Runtime documentation for details about how pureQuery maps query
results to pureQuery beans.queryFirst in interface
DataROW - the generic type of the Object to return. <ROW> is indicated by the generic type of returnClass.sql - the SQL string to executereturnClass - used to represent the first row of the results. This parameter indicates the type that is represented by <ROW>.parameters - used as the parameters to the sql.<ROW>. See the IBM Data Studio pureQuery
Runtime documentation for details about how pureQuery maps query results to pureQuery beans.
public Map<String,Object> queryFirst(String sql,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns a Map that represents the first row of the results that is
returned from executing the sql statement. The keys in the Map are the labels of the columns from the row, and the values in the Map are the values that
are stored in the particular columns of that row.queryFirst in interface Datasql - the SQL string to executeparameters - used as the parameters to the sql.Map that represents the first row of the
results that is returned from executing the sql statement. The keys in the Map are the labels of the columns from the row, and the values in the
Map are the values that are stored in the particular columns of that row.
public <ROW> ROW queryFirst(String sql,
RowHandler<ROW> rowHandler,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns the contents of the first row of the
query results in an instance of the class <ROW>. pureQuery uses singleRowHandler (specifically singleRowHandler.handle(ResultSet, Object)) to create each object of type
<ROW>.queryFirst
in interface DataROW - the generic type of the Object to return. <ROW> is indicated by the generic type of rowHandler.sql - the SQL string to executerowHandler - the RowHandler
whose rowHandler.handle(ResultSet, Object) method maps the
contents of each row to an Object of type <ROW>parameters - used as the parameters to the sql.first row of the query results in an instance of the class <ROW>
public <ROW> Iterator<ROW> queryIterator(int type,
int concurrency,
int holdability,
String sql,
Class<ROW> returnClass,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns an Iterator instance such that each call to the Iterator.next() method of the Iterator instance
provides the contents of a row of the query results in a pureQuery bean that is an instance of the class <ROW>. See the IBM Data Studio pureQuery Runtime documentation for
details about how pureQuery maps query results to pureQuery beans.queryIterator in interface
DataROW - the generic type of the Iterator to return. <ROW> is indicated by the generic type of returnClass.type - the type runtime attribute for query processing. Supported values are: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, and
ResultSet.TYPE_SCROLL_INSENSITIVE.concurrency - the concurrency runtime attribute for query processing. Supported values are: ResultSet.CONCUR_READ_ONLY and ResultSet.CONCUR_UPDATABLE.holdability - the holdability runtime attribute for query processing. Supported values are: ResultSet.CLOSE_CURSORS_AT_COMMIT and
ResultSet.HOLD_CURSORS_OVER_COMMIT.sql - the SQL string to executereturnClass - used to represent each row of the results in the returned instance of Iterator. This parameter indicates the type that is represented by <ROW>.parameters - used when executing the sqlIterator instance such that each call to the
Iterator.next() method of the
Iterator instance provides the contents of a row of the query results in a pureQuery bean that is an instance of the class <ROW>
public Iterator<Map<String,Object>> queryIterator(int type,
int concurrency,
int holdability,
String sql,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns an Iterator instance such that each call to the Iterator.next() method of the instance provides the contents
of a row of the query results in a Map. The keys in the
Map are the labels of the columns from the row, and the values in the Map are the values that are stored in the particular columns of that row.queryIterator in interface
Datatype - the type runtime attribute for query processing. Supported values are: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, and
ResultSet.TYPE_SCROLL_INSENSITIVE.concurrency - the concurrency runtime attribute for query processing. Supported values are: ResultSet.CONCUR_READ_ONLY and ResultSet.CONCUR_UPDATABLE.holdability - the holdability runtime attribute for query processing. Supported values are: ResultSet.CLOSE_CURSORS_AT_COMMIT and
ResultSet.HOLD_CURSORS_OVER_COMMIT.sql - the SQL string to executeparameters - used as the parameters to the sql.Iterator instance such that each call to the
Iterator.next() method of the instance
provides the contents of a row of the query results in a Map.
public <ROW> Iterator<ROW> queryIterator(int type,
int concurrency,
int holdability,
String sql,
RowHandler<ROW> rowHandler,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns an Iterator instance such that each call to the Iterator.next() method of the Iterator instance
provides the contents of a row of the query results in an instance of the class <ROW>. pureQuery uses singleRowHandler (specifically singleRowHandler.handle(ResultSet, Object)) to create each object of type
<ROW>.queryIterator
in interface DataROW - the generic type of the Iterator to return. <ROW> is indicated by the generic type of rowHandler.type - the type runtime attribute for query processing. Supported values are: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, and
ResultSet.TYPE_SCROLL_INSENSITIVE.concurrency - the concurrency runtime attribute for query processing. Supported values are: ResultSet.CONCUR_READ_ONLY and ResultSet.CONCUR_UPDATABLE.holdability - the holdability runtime attribute for query processing. Supported values are: ResultSet.CLOSE_CURSORS_AT_COMMIT and
ResultSet.HOLD_CURSORS_OVER_COMMIT.sql - the SQL string to executerowHandler - the RowHandler
whose rowHandler.handle(ResultSet, Object) method maps the
contents of each row to an Object of type <ROW>parameters - used as the parameters to the sql.Iterator instance such that each call to the
Iterator.next() method of the
Iterator instance provides the contents of a row of the query results in a an instance of the class <ROW>.
public <ROW> Iterator<ROW> queryIterator(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer,
Object... parameters)
queryIterator in interface com.ibm.pdq.runtime.generator.GeneratorData
public <ROW> Iterator<ROW> queryIterator(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
Object... parameters)
queryIterator in interface com.ibm.pdq.runtime.generator.GeneratorData
public <ROW> Iterator<ROW> queryIterator(String sql,
Class<ROW> returnClass,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns an Iterator instance such that each call to the Iterator.next() method of the Iterator instance
provides the contents of a row of the query results in a pureQuery bean that is an instance of the class <ROW>. See the IBM Data Studio pureQuery Runtime documentation for
details about how pureQuery maps query results to pureQuery beans.queryIterator in interface
DataROW - the generic type of the Iterator to return. <ROW> is indicated by the generic type of returnClass.sql - the SQL string to executereturnClass - used to represent each row of the results in the returned instance of Iterator. This parameter indicates the type that is represented by <ROW>.parameters - used when executing the sqlIterator instance such that each call to the
Iterator.next() method of the
Iterator instance provides the contents of a row of the query results in a pureQuery bean that is an instance of the class <ROW>
public Iterator<Map<String,Object>> queryIterator(String sql,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns an Iterator instance such that each call to the Iterator.next() method of the instance provides the contents
of a row of the query results in a Map. The keys in the
Map are the labels of the columns from the row, and the values in the Map are the values that are stored in the particular columns of that row.queryIterator in interface Datasql - the SQL string to executeparameters - used as the parameters to the sql.Iterator instance such that each call to the
Iterator.next() method of the instance
provides the contents of a row of the query results in a Map.
public <ROW> Iterator<ROW> queryIterator(String sql,
RowHandler<ROW> rowHandler,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns an Iterator instance such that each call to the Iterator.next() method of the Iterator instance
provides the contents of a row of the query results in an instance of the class <ROW>. pureQuery uses singleRowHandler (specifically singleRowHandler.handle(ResultSet, Object)) to create each object of type
<ROW>.queryIterator in interface
DataROW - the generic type of the Iterator to return. <ROW> is indicated by the generic type of rowHandler.sql - the SQL string to executerowHandler - the RowHandler
whose rowHandler.handle(ResultSet, Object) method maps the
contents of each row to an Object of type <ROW>parameters - used as the parameter to the sql.Iterator instance such that each call to the
Iterator.next() method of the
Iterator instance provides the contents of a row of the query results in a an instance of the class <ROW>
public <ROW> List<ROW> queryList(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer,
Object... parameters)
queryList in interface com.ibm.pdq.runtime.generator.GeneratorData
public <ROW> List<ROW> queryList(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
Object... parameters)
queryList in interface com.ibm.pdq.runtime.generator.GeneratorData
public <ROW> List<ROW> queryList(String sql,
Class<ROW> returnClass,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns a List instance such that each element in the List instance
contains the contents of a row of the query results in a pureQuery bean that is an instance of the class <ROW>. See the IBM Data Studio pureQuery Runtime documentation for
details about how pureQuery maps query results to pureQuery beans.queryList in interface DataROW - the generic type of the List to
return. <ROW> is indicated by the generic type of returnClass.sql - the SQL string to executereturnClass - used to represent each row of the results in the returned instance of List. This parameter indicates the type that is represented by <ROW>.parameters - used as the parameters to the sql.List instance such that each element in the
List instance contains the contents of a row of the query results in a pureQuery bean that is an instance of the class <ROW>
public List<Map<String,Object>> queryList(String sql,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns a List instance such that each element in the List instance
contains the contents of a row of the query results in a Map. The
keys in the Map are the labels of the columns from the row, and the values in the Map are the values that are stored in the particular columns of that row.queryList in interface Datasql - the SQL string to executeparameters - used as the parameters to the sql.List instance such that each element in the
List instance contains the contents of a row of the query results in a Map
public <ROW> List<ROW> queryList(String sql,
RowHandler<ROW> rowHandler,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns a List instance such that each element in the List instance
contains the contents of a row of the query results in an instance of the class <ROW>. pureQuery uses singleRowHandler (specifically singleRowHandler.handle(ResultSet, Object)) to create each object of type
<ROW>.queryList in
interface DataROW - the generic type of the List to
return. <ROW> is indicated by the generic type of rowHandler.sql - the SQL string to executerowHandler - the RowHandler
whose rowHandler.handle(ResultSet, Object) method maps the
contents of each row to an Object of type <ROW>parameters - used as the parameters to the sql.List instance such that each element in the
List instance contains the contents of a row of the query results in an instance of the class <ROW>
public ResultSet queryResults(int type,
int concurrency,
int holdability,
String sql,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns the contents of the query results in an instance of
ResultSet. The returned ResultSet is
read-only.queryResults in interface
Datatype - the type runtime attribute for query processing. Supported values are: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, and
ResultSet.TYPE_SCROLL_INSENSITIVE.concurrency - the concurrency runtime attribute for query processing. Supported values are: ResultSet.CONCUR_READ_ONLY and ResultSet.CONCUR_UPDATABLE.holdability - the holdability runtime attribute for query processing. Supported values are: ResultSet.CLOSE_CURSORS_AT_COMMIT and
ResultSet.HOLD_CURSORS_OVER_COMMIT.sql - the SQL string to executeparameters - used as the parameters to the sql.ResultSet. The returned ResultSet is read-only.
public ResultSet queryResults(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer,
Object... parameters)
queryResults in interface com.ibm.pdq.runtime.generator.GeneratorData
public ResultSet queryResults(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
Object... parameters)
queryResults in interface com.ibm.pdq.runtime.generator.GeneratorData
public ResultSet queryResults(String sql,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns the contents of the query results in an instance of
ResultSet. The returned ResultSet is
read-only.queryResults in interface Datasql - the SQL string to executeparameters - used as the parameters to the sql.ResultSet. The returned ResultSet is read-only.public void rollback()
DataConnection.rollback() to the associated instance of Connection.rollback in interface DataConnection, Connection.rollback()public void setAutoCommit(boolean autoCommit)
DataConnection by calling Connection.setAutoCommit(boolean) for the Connection instance. Calling this method with autoCommit equal to
true causes auto-commit mode to be enabled, and calling this method with autoCommit equal to false causes auto-commit mode to be disabled.setAutoCommit in interface DataautoCommit - a boolean indicator of whether to enable or disable auto-commit mode. Calling this method with autoCommit equal to
true causes auto-commit mode to be enabled, and calling this method with autoCommit equal to false causes auto-commit mode to be disabled.Connection, Connection.setAutoCommit(boolean)public void setData(Data data)
setData in interface com.ibm.pdq.runtime.generator.GeneratorDatapublic void setLogger(com.ibm.pdq.runtime.internal.trace.DataLogger logger)
public void startBatch(HeterogeneousBatchKind batchKind)
DatapureQuery performs heterogeneous updates with parameters by queueing INSERT, UPDATE, and DELETE SQL statements in memory for a particular instance of Data, and then
executing the queued statements in one network trip. The implementation classes that the pureQuery Generator creates for user-supplied interfaces of annotated methods implement the
user-provided interfaces, as well as the Data interface. See the IBM Data Studio pureQuery Runtime documentation for an explaination of how to perform heterogeneous batches
with parameters when using the annotated-method programming style.
Calling data.startBatch
(HeterogeneousBatchKind.heterogeneousModify__) starts a batch for a heterogeneous update with parameters for the instance of Data. INSERT, UPDATE, and DELETE SQL
statement are then queued in the batch by calling pureQuery annotated and inline methods in the instance of Data. If an attempt is made to add SQL statements other than
INSERT, UPDATE, and DELETE to the batch (by calling methods that excute SQL statements that are not INSERT, UPDATE, or DELETE), an exception is thrown, the current batch is cleared, and
none of the SQL statements are executed. When all of the necessary SQL statements have been added to the batch, the batch can be executed by calling data.endBatch().
When methods are called to add INSERT, UPDATE, and DELETE SQL statements to the batch, methods performing updates return Statement.SUCCESS_NO_INFO, and methods performing
updateManys return null. These results indicate that the SQL statement is successfully added to the batch; the SQL statements are not executed against the
database until endBatch() is called.
A batch of SQL statements is passed to the database as a single transaction. Therefore, Data.commit()
and Data.rollback() cannot be called after startBatch(HeterogeneousBatchKind) is called and
before endBatch() is called. If commit() or rollback is called while a batch is being constructed, an exception is thrown, the current batch is
cleared, and none of the SQL statements are executed.
Heterogeneous updates with parameters use functionality that is unique to DB2 and the IBM DB2 Universal JDBC Driver. An exception is thrown if
startBatch(HeterogeneousBatchKind) or endBatch() is called with any other database or database driver.
startBatch in interface DatabatchKind - the type of batch to create. The only valid value is HeterogeneousBatchKind.heterogeneousModify__.Data.endBatch(), Data.getBatchKind(), HeterogeneousBatchKind
public static final <T> T testNull(T obj,
boolean isNull)
public <ROW> int update(ROW returnClass,
com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer,
Object... parameters)
update in interface com.ibm.pdq.runtime.generator.GeneratorData
public <ROW> int update(ROW returnClass,
com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
Object... parameters)
update in interface com.ibm.pdq.runtime.generator.GeneratorData
public int update(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer,
Object... parameters)
update in interface com.ibm.pdq.runtime.generator.GeneratorData
public int update(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
Object... parameters)
update in interface com.ibm.pdq.runtime.generator.GeneratorData
public <T> T update(String sql,
Class<T> returnClass,
String[] columnNames,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns an autogenerated key, if one was generated, for one or
all of the columns that are specified in columnNames, and possibly returns the update count as well. The return type is determined by the value of returnClass.
columnNames is a String[] in which each element indicates the name of a column for which an autogenerated key might be generated. The returned value is an
instance of the class returnClass that can be either of the following values:
returnClass is Object.class, an Object[] of size n=(columnNames.length+1) is returned. The first
m=(columnNames.length) elements in the returned array are the values of the columns of an autogenerated key, with each element being the contents of
the column for which the corresponding String in columnNames is a column label. The last element in the returned array is an update count that indicates the
number of rows that were updated when the SQL statement was executed.returnClass is not Object.class, a scalar value is returned for the single autogenerated key in the column that is indicated by the
name in columnNames[0].The sql statement must be a statement for which PreparedStatement.executeUpdate() can be performed. That is, the sql statement must be one of the following types of
statements:
Columns that are autogenerated must have their names listed in columnNames if their generated values are to be returned. If the name of an autogenerated column is not
listed, its contents are ignored.
update in
interface DataT - the generic type of the Object that is used to contain an autogenerated key. <T> is indicated by the generic type of
returnClass.sql - the SQL string to executereturnClass - used to return the key that is autogenerated when the sql statement is executed. This parameter indicates the type that is represented by
<T>.columnNames - a String[] in which each element indicates the name of a column that might be generated as part or all of an autogenerated key. Columns
that are autogenerated must have their names listed in this array if their generated values are to be returned.parameters - used as the parameters to the sql.returnClass such that:
returnClass is Object.class, an Object[] of size n=(columnNames.length+1) is returned. The first
m=(columnNames.length) elements in the returned array are the values of the columns of an autogenerated key, with each element being the
contents of the column for which the corresponding String in columnNames is a column label. The last element in the returned array is an update count
that indicates the number of rows that were updated when the SQL statement was executed.returnClass is not Object.class, a scalar value is returned for the single autogenerated key in the column that is
indicated by the name in columnNames[0].Statement.getGeneratedKeys(),
Connection.prepareStatement(String, String[])
public int update(String sql,
Object... parameters)
Datasql statement (with parameters that provide parameters to sql) and returns an int that indicaties how many rows in
the data source are updated.
The sql statement must be a statement for which PreparedStatement.executeUpdate() can be performed. That is, the sql statement must be one of the following types of
statements:
update in interface Datasql - the SQL string to executeparameters - used as the parameters to the sql.int that indicates how many rows in the data source are updated
public <T> int[] updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer,
Iterable<T> parameters)
updateMany in interface com.ibm.pdq.runtime.generator.GeneratorData
public <T> int[] updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer,
Iterator<T> parameters)
updateMany in interface com.ibm.pdq.runtime.generator.GeneratorData
public <T> int[] updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer,
T[] parameters)
updateMany in interface com.ibm.pdq.runtime.generator.GeneratorData
public <T> int[] updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
Iterable<T> parameters)
updateMany in interface com.ibm.pdq.runtime.generator.GeneratorData
public <T> int[] updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
Iterator<T> parameters)
updateMany in interface com.ibm.pdq.runtime.generator.GeneratorData
public <T> int[] updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
T[] parameters)
updateMany in interface com.ibm.pdq.runtime.generator.GeneratorDatapublic int[] updateMany(String... heterogeneousBatchSQL)
Dataint[] of update counts is returned in the format that is used for the return value of Statement.executeBatch(). If one or more SQLExceptions
are returned from the JDBC driver, they are wrapped within an UpdateManyException as the "cause." Because multiple SQLExceptions can be returned by the JDBC driver, they are chained
together and can be retrieved by calling the SQLException method getNextException (which returns an SQLException) until a null is returned.updateMany in interface DataheterogeneousBatchSQL - multiple SQL strings (or one String array) that cannot be null. The SQL cannot return a ResultSet or contain a parameter marker.int[] that provides the update counts for executing the SQL in the format that is used for the return value of Statement.executeBatch(). The length of the
int array is the same as the number of SQL statements given. An array of size 0 is returned if the batch was never executed.
public <T> int[] updateMany(String sql,
Iterable<T> parameters)
Datasql statement once for each element in parameters (with parameters that provide parameters to sql for each
execution) and returns an int[] in which each element in the int[] indicates the update count (that is, the number of rows that were updated) for the
corresponding execution of the sql statement. The order of entries in the returned int[] matches the order in which the sql statements were
executed; therefore, it corresponds to the order of statements that are represented by parameters.
parameters is an Iterable in which each
element is a Map or an Object[] of parameters
for the sql statement. The sql statement is executed one time for each element of parameters, and each time, the parameters for the sql
are provided by the Map or Object[] in the element.
The sql statement must be a statement for which Statement.executeBatch() can be performed. That is, the sql statement must be one of the following types of statements:
updateMany in interface DataT - the generic type of the parameters Iterablesql - the SQL string to executeparameters - an Iterable of type
<T> in which each entry is either a Map or an Object[] that contains a set of parameters to use in the sql. The sql statement is
executed once for each element in parameters. Each time the sql statement is executed, the contents of the Map or Object[] in that
element are the parameters for the sql for that execution.int[] that provides the update counts for executing the SQL in the format that is used for the return value of Statement.executeBatch()Statement.executeBatch()
public <T> int[] updateMany(String sql,
Iterator<T> parameters)
Datasql statement once for each element in parameters (with parameters that provide parameters to sql for each
execution) and returns an int[] in which each element in the int[] indicates the update count (that is, the number of rows that were updated) for the
corresponding execution of the sql statement. The order of entries in the returned int[] matches the order in which the sql statements were
executed; therefore, it corresponds to the order of statements that are represented by parameters.
parameters is an Iterator in which each
element is a Map or an Object[] of parameters
for the sql statement. The sql statement is executed one time for each element of parameters, and each time, the parameters for the sql
are provided by the Map or Object[] in the element.
The sql statement must be a statement for which Statement.executeBatch() can be performed. That is, the sql statement must be one of the following types of statements:
updateMany in interface DataT - the generic type of parameterssql - the SQL string to executeparameters - an Iterator of type
<T> in which each entry is either a Map or an Object[] that contains a set of parameters to use in the sql. The sql statement is
executed once for each element in parameters. Each time the sql statement is executed, the contents of the Map or Object[] in that
element are the parameters for the sql for that execution.int[] that provides the update counts for executing the SQL in the format that is used for the return value of Statement.executeBatch().Statement.executeBatch()
public <T> int[] updateMany(String sql,
T[] parameters)
Datasql statement once for each element in parameters (with parameters that provide parameters to sql for each
execution) and returns an int[] in which each element in the int[] indicates the update count (that is, the number of rows that were updated) for the
corresponding execution of the sql statement. The order of entries in the returned int[] matches the order in which the sql statements were
executed; therefore, it corresponds to the order of statements that are represented by parameters.
parameters is a T[] in which each element is a Map or an Object[] of parameters for the sql statement. The sql statement is executed one time
for each element of parameters, and each time, the parameters for the sql are provided by the Map or Object[] in the element.
The sql statement must be a statement for which Statement.executeBatch() can be performed. That is, the sql statement must be one of the following types of statements:
updateMany in interface DataT - the generic type of the parameters T[]sql - the SQL string to executeparameters - a T[] in which each element is either a Map or an Object[] that contains a set of parameter to use in the sql. The sql statement is
executed once for each element in parameters. Each time the sql statement is executed, the contents of the Map or Object[] in that
element are the parameters for the sql for that execution.int[] that provides the update counts for executing the SQL in the format that is used for the return value of Statement.executeBatch()Statement.executeBatch()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||