Package oracle.nosql.driver.ops
Class PreparedStatement
java.lang.Object
oracle.nosql.driver.ops.PreparedStatement
A class encapsulating a prepared query statement. It includes state that
 can be sent to a server and executed without re-parsing the query. It
 includes bind variables which may be set for each successive use of the
 query. The prepared query itself is read-only but this object contains a
 mutable map of bind variables and is not thread-safe if variables are
 used.
 
 A single instance of PreparedStatement is thread-safe if bind variables
 are not used. If bind variables are to be used and the statement
 shared among threads additional instances of PreparedStatement can be
 constructed using copyStatement().
- 
Method SummaryModifier and TypeMethodDescriptionvoidClears all bind variables from the statement.Returns a new instance that shares this object's prepared query, which is immutable, but does not share its variables.Returns a string representation of the query execution plan, if it was requested in thePrepareRequest; null otherwise.Returns a string (JSON) representation of the schema of the query result for this query, if it was requested in thePrepareRequest; null otherwise.Returns the SQL text of this PreparedStatement.Returns the map of variables to use for a prepared query with variables.setVariable(int pos, FieldValue value) Binds an external variable to a given value.setVariable(String name, FieldValue value) Binds an external variable to a given value.
- 
Method Details- 
copyStatementReturns a new instance that shares this object's prepared query, which is immutable, but does not share its variables.- Returns:
- a new PreparedStatement using this instance's prepared query. Bind variables are uninitialized.
 
- 
getSQLTextReturns the SQL text of this PreparedStatement.- Returns:
- the SQL text of this PreparedStatement.
 
- 
getQueryPlanReturns a string representation of the query execution plan, if it was requested in thePrepareRequest; null otherwise.- Returns:
- the string representation of the query execution plan
 
- 
getQuerySchemaReturns a string (JSON) representation of the schema of the query result for this query, if it was requested in thePrepareRequest; null otherwise.- Returns:
- the string representation of the query schema
- Since:
- 5.4
 
- 
getVariablesReturns the map of variables to use for a prepared query with variables.- Returns:
- the map, or null if there are no variables set.
 
- 
clearVariablespublic void clearVariables()Clears all bind variables from the statement.
- 
setVariableBinds an external variable to a given value. The variable is identified by its name.- Parameters:
- name- the name of the variable
- value- the value
- Returns:
- this
 
- 
setVariableBinds an external variable to a given value. The variable is identified by its position within the query string. The variable that appears first in the query text has position 1, the variable that appears second has position 2 and so on.- Parameters:
- pos- the position of the variable
- value- the value
- Returns:
- this
 
 
-