com.ibm.pdq.runtime.generator
Class BaseData

java.lang.Object
  extended by com.ibm.pdq.runtime.generator.BaseData
All Implemented Interfaces:
Data, com.ibm.pdq.runtime.generator.DataWrapper, com.ibm.pdq.runtime.generator.GeneratorData

public class BaseData
extends Object
implements com.ibm.pdq.runtime.generator.GeneratorData

Field Summary

Field Summary
Data TypeField 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 Summary

Constructor Summary
Constructor and Description
BaseData()

Method Summary

Method Summary
Return Data TypeMethod Name and Description
<CAL> CAL
call(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,?,? extends CAL> handlerContainer, Object... parameters)
<CAL> CAL
call(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, Object... parameters)
<CAL> CAL
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.
<CAL> CAL
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)
<RES> RES
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.
<RES> RES
query(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<? extends RES,?,?> handlerContainer, Object... parameters)
<RES> RES
query(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, Object... parameters)
<RES> RES
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.
<ROW> ROW[]
queryArray(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, Class<ROW> returnClass, Object... parameters)
<ROW> ROW[]
queryArray(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer, Class<ROW> returnClass, Object... parameters)
<ROW> ROW[]
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>.
<ROW> 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.
<ROW> ROW[]
queryArray(String sql, RowHandler<ROW> rowHandler, Object... parameters)
Deprecated.
<ROW> ROW
queryFirst(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer, Object... parameters)
<ROW> ROW
queryFirst(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, Object... parameters)
<ROW> ROW
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.
<ROW> ROW
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>.
<ROW> Iterator<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.
<ROW> Iterator<ROW>
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>.
<ROW> Iterator<ROW>
queryIterator(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer, Object... parameters)
<ROW> Iterator<ROW>
queryIterator(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, Object... parameters)
<ROW> Iterator<ROW>
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.
<ROW> Iterator<ROW>
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>.
<ROW> List<ROW>
queryList(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer, Object... parameters)
<ROW> List<ROW>
queryList(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, Object... parameters)
<ROW> List<ROW>
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.
<ROW> List<ROW>
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
<T> T
testNull(T obj, boolean isNull)
<ROW> int
update(ROW returnClass, com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer, Object... parameters)
<ROW> int
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)
<T> T
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.
<T> int[]
updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer, Iterable<T> parameters)
<T> int[]
updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer, Iterator<T> parameters)
<T> int[]
updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer, T[] parameters)
<T> int[]
updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, Iterable<T> parameters)
<T> int[]
updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor, Iterator<T> parameters)
<T> int[]
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).
<T> int[]
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.
<T> int[]
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.
<T> int[]
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

MULTI_ROW_PARAMETERS

public static final int MULTI_ROW_PARAMETERS
See Also:
Constant Field Values

MULTI_ROW_RESULT

public static final int MULTI_ROW_RESULT
See Also:
Constant Field Values

NO_PARAMETERS

public static final int NO_PARAMETERS
See Also:
Constant Field Values

SINGLE_ROW_PARAMETERS

public static final int SINGLE_ROW_PARAMETERS
See Also:
Constant Field Values

SINGLE_ROW_RESULT

public static final int SINGLE_ROW_RESULT
See Also:
Constant Field Values

Constructor Detail

BaseData

public BaseData()

Method Detail

call

public <CAL> CAL call(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                      com.ibm.pdq.runtime.generator.HandlerContainer<?,?,? extends CAL> handlerContainer,
                      Object... parameters)
Specified by:
call in interface com.ibm.pdq.runtime.generator.GeneratorData

call

public <CAL> CAL call(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                      Object... parameters)
Specified by:
call in interface com.ibm.pdq.runtime.generator.GeneratorData

call

public <CAL> CAL call(String sql,
                      CallHandler<CAL> callHandler,
                      Object... parameters)
Description copied from interface: Data
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. 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:

Specified by:
call in interface Data
Type Parameters:
CAL - the generic type of the object to return. <CAL> is indicated by the generic type of callHandler.
Parameters:
sql - the SQL string to execute
callHandler - an instance of an implementation of the CallHandler
parameters - 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.
Returns:
the output of the CallHandler
See Also:
Data.call(String, CallHandlerWithParameters, Object...), CallHandler

call

public <CAL> CAL call(String sql,
                      CallHandlerWithParameters<CAL> callHandler,
                      Object... parameters)
Description copied from interface: Data
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. 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:

Specified by:
call in interface Data
Type Parameters:
CAL - the generic type of the object to return. <CAL> is indicated by the generic type of callHandlerWithParameters.
Parameters:
sql - the SQL string to execute
callHandler - an instance of an implementation of the CallHandlerWithParameters
parameters - 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.
Returns:
the output of the CallHandlerWithParameters
See Also:
CallHandlerWithParameters

call

public StoredProcedureResult call(String sql,
                                  Object... parameters)
Description copied from interface: Data
Executes the given sql 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:

However, the updated values of all the OUT and INOUT parameters of the called stored procedure can be obtained by calling StoredProcedureResult.getOutputParms().

Specified by:
call in interface Data
Parameters:
sql - the SQL string to execute
parameters - 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().
Returns:
an instance of StoredProcedureResult that represents the results of executing the sql stored procedure call
See Also:
StoredProcedureResult

checkCompatibleRuntimeVersion

public void checkCompatibleRuntimeVersion(String generatorVersion)
                                   throws DataRuntimeException
Throws:
DataRuntimeException

close

public void close()
Description copied from interface: Data
Frees all resources and closes the associated instance of Connection by calling Connection.close() for that instance.
Specified by:
close in interface Data
See Also:
Connection.close()

commit

public void commit()
Description copied from interface: Data
Delegates a commit request (Connection.commit()) to the associated instance of Connection.
Specified by:
commit in interface Data
See Also:
Connection, Connection.commit()

createStatementDescriptor

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)

createStatementDescriptor

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)

createStatementDescriptor

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)

createStatementDescriptor

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)

createStatementDescriptor

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)

endBatch

public int[][] endBatch()
Description copied from interface: Data
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. 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.

Specified by:
endBatch in interface Data
Returns:
an int 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.
See Also:
Data.startBatch(HeterogeneousBatchKind), Data.getBatchKind(), UpdateManyException, HeterogeneousBatchKind

getAutoCommit

public boolean getAutoCommit()
Description copied from interface: Data
Returns a boolean 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.
Specified by:
getAutoCommit in interface Data
Returns:
a boolean 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.
See Also:
Connection, Connection.getAutoCommit()

getBatchKind

public HeterogeneousBatchKind getBatchKind()
Description copied from interface: Data
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.
Specified by:
getBatchKind in interface Data
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.
See Also:
Data.endBatch(), Data.startBatch(HeterogeneousBatchKind), HeterogeneousBatchKind

getConnection

public Connection getConnection()
Description copied from interface: Data
Returns the Connection 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.
Specified by:
getConnection in interface Data
Returns:
the Connection 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.
See Also:
Connection

getData

public Data getData()
Specified by:
getData in interface com.ibm.pdq.runtime.generator.GeneratorData

getGeneratorVersion

public String getGeneratorVersion()

getLogger

public com.ibm.pdq.runtime.internal.trace.DataLogger getLogger()
Description copied from interface: Data
Returns the instance of DataLogger to use for all of the logging that occurrs in association with the instance of Data.
Specified by:
getLogger in interface Data
Returns:
the instance of DataLogger to use for all of the logging that occurrs in association with the instance of Data

getStatementDescriptor

public com.ibm.pdq.runtime.statement.StatementDescriptor getStatementDescriptor(String methodNameAndParameterTypesString)
Specified by:
getStatementDescriptor in interface com.ibm.pdq.runtime.generator.DataWrapper

getStatementDescriptor

public com.ibm.pdq.runtime.statement.StatementDescriptor getStatementDescriptor(String methodNameAndParameterTypesString,
                                                                                String dynamicSql,
                                                                                com.ibm.pdq.runtime.statement.SqlStatementType sqlStatementType,
                                                                                int section,
                                                                                Object[] generatorMetaData)

query

public <RES> RES query(int type,
                       int concurrency,
                       int holdability,
                       String sql,
                       ResultHandler<RES> handler,
                       Object... parameters)
Description copied from interface: Data
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. 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).
Specified by:
query in interface Data
Type Parameters:
RES - the generic type of the Object to return. <RES> is indicated by the generic type of handler.
Parameters:
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 execute
handler - 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.
Returns:
an 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).
See Also:
ResultHandler

query

public <RES> RES query(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                       com.ibm.pdq.runtime.generator.HandlerContainer<? extends RES,?,?> handlerContainer,
                       Object... parameters)
Specified by:
query in interface com.ibm.pdq.runtime.generator.GeneratorData

query

public <RES> RES query(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                       Object... parameters)
Specified by:
query in interface com.ibm.pdq.runtime.generator.GeneratorData

query

public <RES> RES query(String sql,
                       ResultHandler<RES> handler,
                       Object... parameters)
Description copied from interface: Data
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. 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).
Specified by:
query in interface Data
Type Parameters:
RES - the generic type of the Object to return. <RES> is indicated by the generic type of handler.
Parameters:
sql - the SQL string to execute
handler - 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.
Returns:
an 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).
See Also:
ResultHandler

queryArray

public <ROW> ROW[] queryArray(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                              Class<ROW> returnClass,
                              Object... parameters)
Specified by:
queryArray in interface com.ibm.pdq.runtime.generator.GeneratorData

queryArray

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)
Specified by:
queryArray in interface com.ibm.pdq.runtime.generator.GeneratorData

queryArray

public <ROW> ROW[] queryArray(String sql,
                              Class<ROW> returnClass,
                              Object... parameters)
Description copied from interface: Data
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>. See the IBM Data Studio pureQuery Runtime documentation for details about how pureQuery maps query results to pureQuery beans.
Specified by:
queryArray in interface Data
Type Parameters:
ROW - the generic type of the array to return. <ROW> is indicated by the generic type of returnClass.
Parameters:
sql - the SQL string to execute
returnClass - 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.
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

public <ROW> ROW[] queryArray(String sql,
                              Class<ROW> returnClass,
                              RowHandler<ROW> rowHandler,
                              Object... parameters)
Description copied from interface: Data
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>. pureQuery uses singleRowHandler (specifically singleRowHandler.handle(ResultSet, Object)) to create each object of type <ROW>.
Specified by:
queryArray in interface Data
Type Parameters:
ROW - the generic type of the array to return. <ROW> is indicated by the generic type of rowHandler.
Parameters:
sql - the SQL string to execute
returnClass - 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.
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>

queryArray

public Map<String,Object>[] queryArray(String sql,
                                       Object... parameters)
Description copied from interface: Data
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. 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.
Specified by:
queryArray in interface Data
Parameters:
sql - the SQL string to execute
parameters - used as the parameters to the sql.
Returns:
an array such that each element in the array contains the contents of a row of the query results in a Map

queryArray

@Deprecated
public <ROW> ROW[] queryArray(String sql,
                                         RowHandler<ROW> rowHandler,
                                         Object... parameters)
Deprecated.
Specified by:
queryArray in interface Data

queryFirst

public <ROW> ROW queryFirst(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                            com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer,
                            Object... parameters)
Specified by:
queryFirst in interface com.ibm.pdq.runtime.generator.GeneratorData

queryFirst

public <ROW> ROW queryFirst(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                            Object... parameters)
Specified by:
queryFirst in interface com.ibm.pdq.runtime.generator.GeneratorData

queryFirst

public <ROW> ROW queryFirst(String sql,
                            Class<ROW> returnClass,
                            Object... parameters)
Description copied from interface: Data
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>. See the IBM Data Studio pureQuery Runtime documentation for details about how pureQuery maps query results to pureQuery beans.
Specified by:
queryFirst in interface Data
Type Parameters:
ROW - the generic type of the Object to return. <ROW> is indicated by the generic type of returnClass.
Parameters:
sql - the SQL string to execute
returnClass - 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.
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

public Map<String,Object> queryFirst(String sql,
                                     Object... parameters)
Description copied from interface: Data
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. 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.
Specified by:
queryFirst in interface Data
Parameters:
sql - the SQL string to execute
parameters - used as the parameters to the sql.
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

public <ROW> ROW queryFirst(String sql,
                            RowHandler<ROW> rowHandler,
                            Object... parameters)
Description copied from interface: Data
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>. pureQuery uses singleRowHandler (specifically singleRowHandler.handle(ResultSet, Object)) to create each object of type <ROW>.
Specified by:
queryFirst in interface Data
Type Parameters:
ROW - the generic type of the Object to return. <ROW> is indicated by the generic type of rowHandler.
Parameters:
sql - the SQL string to execute
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.
Returns:
the contents of the first row of the query results in an instance of the class <ROW>

queryIterator

public <ROW> Iterator<ROW> queryIterator(int type,
                                         int concurrency,
                                         int holdability,
                                         String sql,
                                         Class<ROW> returnClass,
                                         Object... parameters)
Description copied from interface: Data
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>. See the IBM Data Studio pureQuery Runtime documentation for details about how pureQuery maps query results to pureQuery beans.
Specified by:
queryIterator in interface Data
Type Parameters:
ROW - the generic type of the Iterator to return. <ROW> is indicated by the generic type of returnClass.
Parameters:
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 execute
returnClass - 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 sql
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>

queryIterator

public Iterator<Map<String,Object>> queryIterator(int type,
                                                  int concurrency,
                                                  int holdability,
                                                  String sql,
                                                  Object... parameters)
Description copied from interface: Data
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. 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.
Specified by:
queryIterator in interface Data
Parameters:
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 execute
parameters - used as the parameters to the sql.
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

public <ROW> Iterator<ROW> queryIterator(int type,
                                         int concurrency,
                                         int holdability,
                                         String sql,
                                         RowHandler<ROW> rowHandler,
                                         Object... parameters)
Description copied from interface: Data
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>. pureQuery uses singleRowHandler (specifically singleRowHandler.handle(ResultSet, Object)) to create each object of type <ROW>.
Specified by:
queryIterator in interface Data
Type Parameters:
ROW - the generic type of the Iterator to return. <ROW> is indicated by the generic type of rowHandler.
Parameters:
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 execute
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.
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 an instance of the class <ROW>.

queryIterator

public <ROW> Iterator<ROW> queryIterator(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                                         com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer,
                                         Object... parameters)
Specified by:
queryIterator in interface com.ibm.pdq.runtime.generator.GeneratorData

queryIterator

public <ROW> Iterator<ROW> queryIterator(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                                         Object... parameters)
Specified by:
queryIterator in interface com.ibm.pdq.runtime.generator.GeneratorData

queryIterator

public <ROW> Iterator<ROW> queryIterator(String sql,
                                         Class<ROW> returnClass,
                                         Object... parameters)
Description copied from interface: Data
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>. See the IBM Data Studio pureQuery Runtime documentation for details about how pureQuery maps query results to pureQuery beans.
Specified by:
queryIterator in interface Data
Type Parameters:
ROW - the generic type of the Iterator to return. <ROW> is indicated by the generic type of returnClass.
Parameters:
sql - the SQL string to execute
returnClass - 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 sql
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>

queryIterator

public Iterator<Map<String,Object>> queryIterator(String sql,
                                                  Object... parameters)
Description copied from interface: Data
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. 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.
Specified by:
queryIterator in interface Data
Parameters:
sql - the SQL string to execute
parameters - used as the parameters to the sql.
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

public <ROW> Iterator<ROW> queryIterator(String sql,
                                         RowHandler<ROW> rowHandler,
                                         Object... parameters)
Description copied from interface: Data
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>. pureQuery uses singleRowHandler (specifically singleRowHandler.handle(ResultSet, Object)) to create each object of type <ROW>.
Specified by:
queryIterator in interface Data
Type Parameters:
ROW - the generic type of the Iterator to return. <ROW> is indicated by the generic type of rowHandler.
Parameters:
sql - the SQL string to execute
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 parameter to the sql.
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 an instance of the class <ROW>

queryList

public <ROW> List<ROW> queryList(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                                 com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer,
                                 Object... parameters)
Specified by:
queryList in interface com.ibm.pdq.runtime.generator.GeneratorData

queryList

public <ROW> List<ROW> queryList(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                                 Object... parameters)
Specified by:
queryList in interface com.ibm.pdq.runtime.generator.GeneratorData

queryList

public <ROW> List<ROW> queryList(String sql,
                                 Class<ROW> returnClass,
                                 Object... parameters)
Description copied from interface: Data
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>. See the IBM Data Studio pureQuery Runtime documentation for details about how pureQuery maps query results to pureQuery beans.
Specified by:
queryList in interface Data
Type Parameters:
ROW - the generic type of the List to return. <ROW> is indicated by the generic type of returnClass.
Parameters:
sql - the SQL string to execute
returnClass - 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.
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>

queryList

public List<Map<String,Object>> queryList(String sql,
                                          Object... parameters)
Description copied from interface: Data
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. 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.
Specified by:
queryList in interface Data
Parameters:
sql - the SQL string to execute
parameters - used as the parameters to the sql.
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

public <ROW> List<ROW> queryList(String sql,
                                 RowHandler<ROW> rowHandler,
                                 Object... parameters)
Description copied from interface: Data
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>. pureQuery uses singleRowHandler (specifically singleRowHandler.handle(ResultSet, Object)) to create each object of type <ROW>.
Specified by:
queryList in interface Data
Type Parameters:
ROW - the generic type of the List to return. <ROW> is indicated by the generic type of rowHandler.
Parameters:
sql - the SQL string to execute
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.
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>

queryResults

public ResultSet queryResults(int type,
                              int concurrency,
                              int holdability,
                              String sql,
                              Object... parameters)
Description copied from interface: Data
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. The returned ResultSet is read-only.
Specified by:
queryResults in interface Data
Parameters:
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 execute
parameters - used as the parameters to the sql.
Returns:
the contents of the query results in an instance of ResultSet. The returned ResultSet is read-only.

queryResults

public ResultSet queryResults(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                              com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer,
                              Object... parameters)
Specified by:
queryResults in interface com.ibm.pdq.runtime.generator.GeneratorData

queryResults

public ResultSet queryResults(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                              Object... parameters)
Specified by:
queryResults in interface com.ibm.pdq.runtime.generator.GeneratorData

queryResults

public ResultSet queryResults(String sql,
                              Object... parameters)
Description copied from interface: Data
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. The returned ResultSet is read-only.
Specified by:
queryResults in interface Data
Parameters:
sql - the SQL string to execute
parameters - used as the parameters to the sql.
Returns:
the contents of the query results in an instance of ResultSet. The returned ResultSet is read-only.

rollback

public void rollback()
Description copied from interface: Data
Delegates a rollback request Connection.rollback() to the associated instance of Connection.
Specified by:
rollback in interface Data
See Also:
Connection, Connection.rollback()

setAutoCommit

public void setAutoCommit(boolean autoCommit)
Description copied from interface: Data
Sets whether auto-commit mode is enabled for the associated instance of Connection 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.
Specified by:
setAutoCommit in interface Data
Parameters:
autoCommit - 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.
See Also:
Connection, Connection.setAutoCommit(boolean)

setData

public void setData(Data data)
Specified by:
setData in interface com.ibm.pdq.runtime.generator.GeneratorData

setLogger

public void setLogger(com.ibm.pdq.runtime.internal.trace.DataLogger logger)

startBatch

public void startBatch(HeterogeneousBatchKind batchKind)
Description copied from interface: Data
Starts a batch for a heterogeneous update with parameters.

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().

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.

Specified by:
startBatch in interface Data
Parameters:
batchKind - the type of batch to create. The only valid value is HeterogeneousBatchKind.heterogeneousModify__.
See Also:
Data.endBatch(), Data.getBatchKind(), HeterogeneousBatchKind

testNull

public static final <T> T testNull(T obj,
                                   boolean isNull)

update

public <ROW> int update(ROW returnClass,
                        com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                        com.ibm.pdq.runtime.generator.HandlerContainer<?,? extends ROW,?> handlerContainer,
                        Object... parameters)
Specified by:
update in interface com.ibm.pdq.runtime.generator.GeneratorData

update

public <ROW> int update(ROW returnClass,
                        com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                        Object... parameters)
Specified by:
update in interface com.ibm.pdq.runtime.generator.GeneratorData

update

public int update(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                  com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer,
                  Object... parameters)
Specified by:
update in interface com.ibm.pdq.runtime.generator.GeneratorData

update

public int update(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                  Object... parameters)
Specified by:
update in interface com.ibm.pdq.runtime.generator.GeneratorData

update

public <T> T update(String sql,
                    Class<T> returnClass,
                    String[] columnNames,
                    Object... parameters)
Description copied from interface: Data
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. 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:

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.

Specified by:
update in interface Data
Type Parameters:
T - the generic type of the Object that is used to contain an autogenerated key. <T> is indicated by the generic type of returnClass.
Parameters:
sql - the SQL string to execute
returnClass - 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.
Returns:
an instance of the class returnClass such that:
  • If the class 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.
  • If the class 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].
See Also:
Statement.getGeneratedKeys(), Connection.prepareStatement(String, String[])

update

public int update(String sql,
                  Object... parameters)
Description copied from interface: Data
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.

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:

Specified by:
update in interface Data
Parameters:
sql - the SQL string to execute
parameters - used as the parameters to the sql.
Returns:
an int that indicates how many rows in the data source are updated

updateMany

public <T> int[] updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                            com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer,
                            Iterable<T> parameters)
Specified by:
updateMany in interface com.ibm.pdq.runtime.generator.GeneratorData

updateMany

public <T> int[] updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                            com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer,
                            Iterator<T> parameters)
Specified by:
updateMany in interface com.ibm.pdq.runtime.generator.GeneratorData

updateMany

public <T> int[] updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                            com.ibm.pdq.runtime.generator.HandlerContainer<?,?,?> handlerContainer,
                            T[] parameters)
Specified by:
updateMany in interface com.ibm.pdq.runtime.generator.GeneratorData

updateMany

public <T> int[] updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                            Iterable<T> parameters)
Specified by:
updateMany in interface com.ibm.pdq.runtime.generator.GeneratorData

updateMany

public <T> int[] updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                            Iterator<T> parameters)
Specified by:
updateMany in interface com.ibm.pdq.runtime.generator.GeneratorData

updateMany

public <T> int[] updateMany(com.ibm.pdq.runtime.statement.StatementDescriptor statementDescriptor,
                            T[] parameters)
Specified by:
updateMany in interface com.ibm.pdq.runtime.generator.GeneratorData

updateMany

public int[] updateMany(String... heterogeneousBatchSQL)
Description copied from interface: Data
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). The SQL cannot return a results set and cannot contain parameter markers or host variables. All data must be literals. An int[] 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.
Specified by:
updateMany in interface Data
Parameters:
heterogeneousBatchSQL - multiple SQL strings (or one String array) that cannot be null. The SQL cannot return a ResultSet or contain a parameter marker.
Returns:
an 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.

updateMany

public <T> int[] updateMany(String sql,
                            Iterable<T> parameters)
Description copied from interface: Data
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. 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:

Specified by:
updateMany in interface Data
Type Parameters:
T - the generic type of the parameters Iterable
Parameters:
sql - the SQL string to execute
parameters - 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.
Returns:
an int[] that provides the update counts for executing the SQL in the format that is used for the return value of Statement.executeBatch()
See Also:
Statement.executeBatch()

updateMany

public <T> int[] updateMany(String sql,
                            Iterator<T> parameters)
Description copied from interface: Data
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. 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:

Specified by:
updateMany in interface Data
Type Parameters:
T - the generic type of parameters
Parameters:
sql - the SQL string to execute
parameters - 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.
Returns:
an int[] that provides the update counts for executing the SQL in the format that is used for the return value of Statement.executeBatch().
See Also:
Statement.executeBatch()

updateMany

public <T> int[] updateMany(String sql,
                            T[] parameters)
Description copied from interface: Data
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. 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:

Specified by:
updateMany in interface Data
Type Parameters:
T - the generic type of the parameters T[]
Parameters:
sql - the SQL string to execute
parameters - 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.
Returns:
an int[] that provides the update counts for executing the SQL in the format that is used for the return value of Statement.executeBatch()
See Also:
Statement.executeBatch()