Package com.couchbase.client.java.query
Class PrepareStatement
java.lang.Object
com.couchbase.client.java.query.PrepareStatement
- All Implemented Interfaces:
SerializableStatement,Statement,Serializable
public class PrepareStatement extends Object implements SerializableStatement
A PREPARE
Statement that wraps another Statement in order to send it
to the server and produce a PreparedPayload.- Since:
- 2.1
- Author:
- Simon Baslé
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static StringPREPARE_PREFIXa prefix to be used in order to prepare a named query plan for a statement -
Method Summary
Modifier and Type Method Description StatementoriginalStatement()static PrepareStatementprepare(Statement statement)Construct aPrepareStatementfrom a select-likeStatement.static PrepareStatementprepare(Statement statement, String preparedName)Construct aPrepareStatementfrom a select-likeStatementand give it a name.static PrepareStatementprepare(String statement)Construct aPrepareStatementfrom a statement inStringformat.StringpreparedName()StringtoString()
-
Field Details
-
PREPARE_PREFIX
a prefix to be used in order to prepare a named query plan for a statement- See Also:
- Constant Field Values
-
-
Method Details
-
originalStatement
-
preparedName
-
toString
-
prepare
Construct aPrepareStatementfrom a select-likeStatement. Note that passing aPrepareStatementwill return it directly, whereas passing aPreparedPayloadwill reuse thePreparedPayload.preparedName().- Parameters:
statement- theStatementto prepare.- Returns:
- the prepared statement.
- Throws:
IllegalArgumentException- when statement cannot be prepared.
-
prepare
Construct aPrepareStatementfrom a select-likeStatementand give it a name. Note that passing aPrepareStatementor aPreparedPayloadwill reuse theoriginal statementbut use the given name.- Parameters:
statement- theStatementto prepare.preparedName- the name to give to the prepared statement- Returns:
- the prepared statement.
- Throws:
IllegalArgumentException- when statement cannot be prepared.
-
prepare
Construct aPrepareStatementfrom a statement inStringformat. Statement shouldn't begin with "PREPARE", otherwise a syntax error may be returned by the server.- Parameters:
statement- the statement to prepare (not starting with "PREPARE").- Returns:
- the prepared statement.
- Throws:
NullPointerException- when statement is null.
-