public interface BoundStatement extends PreparedStatement
Represents a Statement
that has been compiled and an execution
plan generated for it. A BoundStatement must be used when the Statement is
a DML statement that contains external variables. It provides methods to
bind the external variables to specific values.
To create an instance of a BoundStatement, an instance of a
PreparedStatement
must be created first, which is done via the
KVStore.prepare(String statement)
method. Next, one or more
BoundStatement instances can be created from the same PreparedStatement via
the method
. Creating
multiple BoundStatements from the same PreparedStatement allows for the
potentially concurrent execution of the PreparedStatement multiple times
with different bind values each time.
Like a PreparedStatement, a BoundStatement can be executed multiple
times via one of the KVStore.execute methods (for example, KVStore.execute(String statement, ExecuteOptions options)
or
KVStore.executeSync(Statement statement, ExecuteOptions options)
).
All the external variables must be bound before execution is initiated.
Objects implementing the PreparedStatement interface are thread-safe and their methods are re-entrant. On the other hand, BoundStatement instances are not thread-safe.
FieldValueFactory
to create values for complex types.
Modifier and Type | Method and Description |
---|---|
Map<String,FieldValue> |
getVariables()
Returns the map of bound variables.
|
BoundStatement |
setVariable(String variableName,
boolean value)
Sets the value of a variable.
|
BoundStatement |
setVariable(String variableName,
byte[] value)
Sets the value of a variable.
|
BoundStatement |
setVariable(String variableName,
double value)
Sets the value of a variable.
|
BoundStatement |
setVariable(String variableName,
FieldValue value)
Sets the value of a variable.
|
BoundStatement |
setVariable(String variableName,
float value)
Sets the value of a variable.
|
BoundStatement |
setVariable(String variableName,
int value)
Sets the value of a variable.
|
BoundStatement |
setVariable(String variableName,
long value)
Sets the value of a variable.
|
BoundStatement |
setVariable(String variableName,
String value)
Sets the value of a variable.
|
createBoundStatement, getResultDef, getVariableType, getVariableTypes
Map<String,FieldValue> getVariables()
BoundStatement setVariable(String variableName, FieldValue value)
variableName
- the name of the query variablevalue
- the value to be setIllegalArgumentException
- if the type of value doesn't match
the type of the variable.BoundStatement setVariable(String variableName, int value)
variableName
- the name of the query variablevalue
- the value to be setIllegalArgumentException
- if the type of value doesn't match
the type of the variable.BoundStatement setVariable(String variableName, boolean value)
variableName
- the name of the query variablevalue
- the value to be setIllegalArgumentException
- if the type of value doesn't match
the type of the variable.BoundStatement setVariable(String variableName, double value)
variableName
- the name of the query variablevalue
- the value to be setIllegalArgumentException
- if the type of value doesn't match
the type of the variable.BoundStatement setVariable(String variableName, float value)
variableName
- the name of the query variablevalue
- the value to be setIllegalArgumentException
- if the type of value doesn't match
the type of the variable.BoundStatement setVariable(String variableName, long value)
variableName
- the name of the query variablevalue
- the value to be setIllegalArgumentException
- if the type of value doesn't match
the type of the variable.BoundStatement setVariable(String variableName, String value)
variableName
- the name of the query variablevalue
- the value to be setIllegalArgumentException
- if the type of value doesn't match
the type of the variable.BoundStatement setVariable(String variableName, byte[] value)
variableName
- the name of the query variablevalue
- the value to be setIllegalArgumentException
- if the type of value doesn't match
the type of the variable.Copyright (c) 2011, 2017 Oracle and/or its affiliates. All rights reserved.