public class PrepareStatement extends Object implements SerializableStatement
Statement
that wraps another Statement in order to send it
to the server and produce a PreparedPayload
.Modifier and Type | Field and Description |
---|---|
static String |
PREPARE_PREFIX
a prefix to be used in order to prepare a named query plan for a statement
|
Modifier and Type | Method and Description |
---|---|
Statement |
originalStatement() |
static PrepareStatement |
prepare(Statement statement)
Construct a
PrepareStatement from a select-like Statement . |
static PrepareStatement |
prepare(Statement statement,
String preparedName)
Construct a
PrepareStatement from a select-like Statement and give it a name. |
static PrepareStatement |
prepare(String statement)
Construct a
PrepareStatement from a statement in String format. |
String |
preparedName() |
String |
toString() |
public static final String PREPARE_PREFIX
public Statement originalStatement()
public String preparedName()
public static PrepareStatement prepare(Statement statement)
PrepareStatement
from a select-like Statement
.
Note that passing a PrepareStatement
will return it directly, whereas passing
a PreparedPayload
will reuse the PreparedPayload.preparedName()
.statement
- the Statement
to prepare.IllegalArgumentException
- when statement cannot be prepared.public static PrepareStatement prepare(Statement statement, String preparedName)
PrepareStatement
from a select-like Statement
and give it a name.
Note that passing a PrepareStatement
or a PreparedPayload
will reuse the
original statement
but use the given name.statement
- the Statement
to prepare.preparedName
- the name to give to the prepared statementIllegalArgumentException
- when statement cannot be prepared.public static PrepareStatement prepare(String statement)
PrepareStatement
from a statement in String
format.
Statement shouldn't begin with "PREPARE", otherwise a syntax error may be returned by the server.statement
- the statement to prepare (not starting with "PREPARE").NullPointerException
- when statement is null.Copyright © 2015 Couchbase, Inc.