Package com.couchbase.client.java.query
Class PreparedN1qlQuery
- java.lang.Object
-
- com.couchbase.client.java.query.N1qlQuery
-
- com.couchbase.client.java.query.AbstractN1qlQuery
-
- com.couchbase.client.java.query.ParameterizedN1qlQuery
-
- com.couchbase.client.java.query.PreparedN1qlQuery
-
- All Implemented Interfaces:
Serializable
@Uncommitted @Private public class PreparedN1qlQuery extends ParameterizedN1qlQuery
Represent a N1QL query, with a parameterized prepared statement plan (for which the values must be passed according to the type and number of placeholders). Positional placeholders (in the form of either "$1" "$2" or just simple "?") are filled by the values taken from aJsonArray. Named placeholders (in the form of "$param1", "$myOtherParam", etc...) are filled by the values taken from aJsonObject. If in this JsonObject attributes don't have the $ prefix, it is added upon building the query.- Since:
- 2.1
- Author:
- Simon Baslé
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PreparedN1qlQuery(PreparedPayload plan, JsonArray positionalParams, N1qlParams params)PreparedN1qlQuery(PreparedPayload plan, JsonObject namedParams, N1qlParams params)PreparedN1qlQuery(PreparedPayload plan, N1qlParams params)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisEncodedPlanEnabled()Returns whether or not the encodedPlan part of the payload will be made part of the N1QL statement.JsonObjectn1ql()Convert this query to a full N1QL query in Json form.voidsetEncodedPlanEnabled(boolean enabled)Toggle whether or not the encodedPlan part of the payload should be made part of the N1QL statement.PreparedPayloadstatement()Returns theStatementfrom this query.protected StringstatementType()The type of the statement, used as JSON name in the final JSON form of the queryprotected ObjectstatementValue()The JSON representation for the underlyingStatementin the final JSON form of the query-
Methods inherited from class com.couchbase.client.java.query.ParameterizedN1qlQuery
isPositional, statementParameters, toString
-
Methods inherited from class com.couchbase.client.java.query.AbstractN1qlQuery
params, populateParameters
-
Methods inherited from class com.couchbase.client.java.query.N1qlQuery
parameterized, parameterized, parameterized, parameterized, parameterized, parameterized, parameterized, parameterized, simple, simple, simple, simple
-
-
-
-
Constructor Detail
-
PreparedN1qlQuery
public PreparedN1qlQuery(PreparedPayload plan, JsonArray positionalParams, N1qlParams params)
-
PreparedN1qlQuery
public PreparedN1qlQuery(PreparedPayload plan, JsonObject namedParams, N1qlParams params)
-
PreparedN1qlQuery
public PreparedN1qlQuery(PreparedPayload plan, N1qlParams params)
-
-
Method Detail
-
statementType
protected String statementType()
Description copied from class:AbstractN1qlQueryThe type of the statement, used as JSON name in the final JSON form of the query- Overrides:
statementTypein classParameterizedN1qlQuery
-
statementValue
protected Object statementValue()
Description copied from class:AbstractN1qlQueryThe JSON representation for the underlyingStatementin the final JSON form of the query- Overrides:
statementValuein classParameterizedN1qlQuery
-
statement
public PreparedPayload statement()
Description copied from class:N1qlQueryReturns theStatementfrom this query. Note that this is the only mandatory part of a N1QL query.- Overrides:
statementin classAbstractN1qlQuery- Returns:
- the statement that forms the base of this query
-
setEncodedPlanEnabled
public void setEncodedPlanEnabled(boolean enabled)
Toggle whether or not the encodedPlan part of the payload should be made part of the N1QL statement.- Parameters:
enabled- true to activate encodedPlan in the N1QL statement, false to avoid including it.
-
isEncodedPlanEnabled
public boolean isEncodedPlanEnabled()
Returns whether or not the encodedPlan part of the payload will be made part of the N1QL statement.- Returns:
- true if encodedPlan is to be used in statement, false otherwise.
-
n1ql
public JsonObject n1ql()
Description copied from class:N1qlQueryConvert this query to a full N1QL query in Json form.- Overrides:
n1qlin classAbstractN1qlQuery- Returns:
- the json representation of this query (including all relevant parameters)
-
-