public interface Statement
extends java.lang.AutoCloseable
To create a statement object, call
Session.createStatement
.
A program that creates a statement object must explicitly call
Statement.close
to reclaim its resources.
This interface is implemented internally. Applications do not implement this interface.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TIBDG_STATEMENT_CONSISTENCY_GLOBAL_SNAPSHOT
Global snapshot consistency; property value constant.
|
static java.lang.String |
TIBDG_STATEMENT_CONSISTENCY_SNAPSHOT
Snapshot consistency; property value constant.
|
static java.lang.String |
TIBDG_STATEMENT_PROPERTY_LONG_PREFETCH
Property name for Statement query prefetch; long.
|
static java.lang.String |
TIBDG_STATEMENT_PROPERTY_STRING_CONSISTENCY
Property name for Statement consistency; string.
|
Modifier and Type | Method and Description |
---|---|
void |
clearParameters()
Clears all of the parameter values set on the statement object.
|
void |
close()
Close the statement object.
|
ResultSet |
executeQuery(java.util.Properties props)
Executes the query on the statement object and returns the resultset object.
|
ResultSetMetadata |
getResultSetMetadata()
Get the metadata associated with a statement
|
void |
setDateTime(int parameterIndex,
TibDateTime value)
Sets a TibDateTime value to a parameter number in a statement object.
|
void |
setDouble(int parameterIndex,
double value)
Sets a double value to a parameter number in a statement object.
|
void |
setLong(int parameterIndex,
long value)
Sets a long value to a parameter number in a statement object.
|
void |
setOpaque(int parameterIndex,
byte[] value)
Sets an opaque value to a parameter number in a statement object.
|
void |
setString(int parameterIndex,
java.lang.String value)
Sets a string value to a parameter number in a statement object.
|
static final java.lang.String TIBDG_STATEMENT_PROPERTY_LONG_PREFETCH
When creating a statement,
supply this property to Session.createStatement
.
Its value determines
the maximum number of rows that will be prefetched from the data grid when executing a query.
static final java.lang.String TIBDG_STATEMENT_CONSISTENCY_GLOBAL_SNAPSHOT
Statement.TIBDG_STATEMENT_PROPERTY_STRING_CONSISTENCY
in the method Session.createStatement
.
This value will cause a global snapshot to be taken across all
nodes in the grid when a query is executed, which will then be used when iterating through the results.
A global snapshot will ensure no partially committed transactions that span multiple nodes
are observed in the query results at the cost of needing to coordinate the global
snapshot when executing the query.static final java.lang.String TIBDG_STATEMENT_CONSISTENCY_SNAPSHOT
Statement.TIBDG_STATEMENT_PROPERTY_STRING_CONSISTENCY
in the method Session.createStatement
.
This value will cause a snapshot to be taken at each node independently when a query is executed,
which will then be used when iterating through the results.
A snapshot taken at each node does not require waiting to create a global
snapshot across the entire grid when creating the iterator but could result
in a partially committed transaction that spanned multiple nodes being
observed in the results.static final java.lang.String TIBDG_STATEMENT_PROPERTY_STRING_CONSISTENCY
When creating a statement,
supply this property to Session.createStatement
.
Its value determines the consistency when executing a query and
whether or not a global snapshot needs to be taken.
Statement.TIBDG_STATEMENT_CONSISTENCY_GLOBAL_SNAPSHOT
Statement.TIBDG_STATEMENT_CONSISTENCY_SNAPSHOT
ResultSet executeQuery(java.util.Properties props) throws DataGridException, DataGridInvalidArgumentException
Cannot be called if there are any open resultsets on the statement object.
props
- Optional, null to omitResultSet
DataGridException
- in case of failuresDataGridInvalidArgumentException
void setDateTime(int parameterIndex, TibDateTime value) throws DataGridException
Copies the datetime parameter so that the program is allowed to free or modify it after the function returns. Note that parameter numbers start from 1. Setting the same parameter multiple times is allowed, even with different types, as long as when ExecuteQuery is called all parameters are set and have the correct types.
parameterIndex
- The parameter number to set.value
- The datetime value to set into the statement.DataGridException
- in case of failuresvoid setDouble(int parameterIndex, double value) throws DataGridException
Note that parameter numbers start from 1. Setting the same parameter multiple times is allowed, even with different types, as long as when ExecuteQuery is called all parameters are set and have the correct types.
parameterIndex
- The parameter number to set.value
- The double value to set into the statement.DataGridException
- in case of failuresvoid setLong(int parameterIndex, long value) throws DataGridException
Note that parameter numbers start from 1. Setting the same parameter multiple times is allowed, even with different types, as long as when ExecuteQuery is called all parameters are set and have the correct types.
parameterIndex
- The parameter number to set.value
- The long value to set into the statement.DataGridException
- in case of failuresvoid setOpaque(int parameterIndex, byte[] value) throws DataGridException
Copies the opaque parameter so that the program is allowed to free or modify it after the function returns. Note that parameter numbers start from 1. Setting the same parameter multiple times is allowed, even with different types, as long as when ExecuteQuery is called all parameters are set and have the correct types.
parameterIndex
- The parameter number to set.value
- The opaque value to set into the statement.DataGridException
- in case of failuresvoid setString(int parameterIndex, java.lang.String value) throws DataGridException
Note that parameter numbers start from 1. Setting the same parameter multiple times is allowed, even with different types, as long as when ExecuteQuery is called all parameters are set and have the correct types.
parameterIndex
- The parameter number to set.value
- The string value to set into the statement.DataGridException
- in case of failuresvoid clearParameters() throws DataGridException
After calling this function, all parameters must be set again before calling ExecuteQuery. A partially bound statement object may be closed without calling this function.
DataGridException
- in case of failuresResultSetMetadata getResultSetMetadata() throws DataGridException
ResultSetMetadata
DataGridException
- in case of failuresvoid close() throws DataGridException
Note that all resultset objects must also be closed to allow for the statement's resources to also be reclaimed.
close
in interface java.lang.AutoCloseable
DataGridException
- in case of failures