Class GenericQueryRequest
- java.lang.Object
-
- com.couchbase.client.core.message.AbstractCouchbaseRequest
-
- com.couchbase.client.core.message.query.GenericQueryRequest
-
- All Implemented Interfaces:
CouchbaseMessage
,CouchbaseRequest
,PrelocatedRequest
,QueryRequest
- Direct Known Subclasses:
RawQueryRequest
public class GenericQueryRequest extends AbstractCouchbaseRequest implements QueryRequest, PrelocatedRequest
For the lack of a better name, a query request against a query server.- Since:
- 1.0
- Author:
- Michael Nitschinger
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterSpanSet(io.opentracing.Span span)
Use this method to add custom span values on insert.boolean
isJsonFormat()
static GenericQueryRequest
jsonQuery(String jsonQuery, String bucket, String password, String contextId)
Create aGenericQueryRequest
and mark it as containing a full N1QL query in Json form (including additional query parameters like named arguments, etc...).static GenericQueryRequest
jsonQuery(String jsonQuery, String bucket, String password, String targetNode, String contextId)
Create aGenericQueryRequest
and mark it as containing a full N1QL query in Json form (including additional query parameters like named arguments, etc...).static GenericQueryRequest
jsonQuery(String jsonQuery, String bucket, String username, String password, String contextId, String statement)
Create aGenericQueryRequest
and mark it as containing a full N1QL query in Json form (including additional query parameters like named arguments, etc...).static GenericQueryRequest
jsonQuery(String jsonQuery, String bucket, String username, String password, String targetNode, String contextId, String statement)
Create aGenericQueryRequest
and mark it as containing a full N1QL query in Json form (including additional query parameters like named arguments, etc...).String
operationId()
Default implementation, sub requests need to override this.String
query()
String
sendTo()
The hostname to send this request to, or null to use defaultnode location process
.static GenericQueryRequest
simpleStatement(String statement, String bucket, String password)
Creates aGenericQueryRequest
and mark it as containing a single simple statement (e.g.static GenericQueryRequest
simpleStatement(String statement, String bucket, String username, String password)
Creates aGenericQueryRequest
and mark it as containing a single simple statement (e.g.-
Methods inherited from class com.couchbase.client.core.message.AbstractCouchbaseRequest
bucket, complete, creationTime, dispatchHostname, dispatchHostname, emit, fail, incrementRetryCount, isActive, lastLocalId, lastLocalId, lastLocalSocket, lastLocalSocket, lastRemoteSocket, lastRemoteSocket, maxRetryDuration, maxRetryDuration, observable, password, retryAfter, retryAfter, retryCount, retryDelay, retryDelay, span, span, subscriber, succeed, toString, username
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.couchbase.client.core.message.CouchbaseMessage
creationTime
-
Methods inherited from interface com.couchbase.client.core.message.CouchbaseRequest
bucket, complete, dispatchHostname, dispatchHostname, emit, fail, incrementRetryCount, isActive, lastLocalId, lastLocalId, lastLocalSocket, lastLocalSocket, lastRemoteSocket, lastRemoteSocket, maxRetryDuration, maxRetryDuration, observable, password, retryAfter, retryAfter, retryCount, retryDelay, retryDelay, span, span, subscriber, succeed, username
-
-
-
-
Method Detail
-
afterSpanSet
protected void afterSpanSet(io.opentracing.Span span)
Description copied from class:AbstractCouchbaseRequest
Use this method to add custom span values on insert.- Overrides:
afterSpanSet
in classAbstractCouchbaseRequest
-
operationId
public String operationId()
Description copied from class:AbstractCouchbaseRequest
Default implementation, sub requests need to override this.- Specified by:
operationId
in interfaceCouchbaseRequest
- Overrides:
operationId
in classAbstractCouchbaseRequest
- Returns:
- the operation id or null.
-
query
public String query()
-
isJsonFormat
public boolean isJsonFormat()
-
sendTo
public String sendTo()
Description copied from interface:PrelocatedRequest
The hostname to send this request to, or null to use defaultnode location process
.- Specified by:
sendTo
in interfacePrelocatedRequest
- Returns:
- the address of the target node or null to revert to default dispatching.
-
simpleStatement
public static GenericQueryRequest simpleStatement(String statement, String bucket, String password)
Creates aGenericQueryRequest
and mark it as containing a single simple statement (e.g. "SELECT * FROM default").- Parameters:
statement
- the N1QL query statement to perform.bucket
- the bucket on which to search.password
- the password for the target bucket.- Returns:
- a
GenericQueryRequest
for this simple statement.
-
simpleStatement
public static GenericQueryRequest simpleStatement(String statement, String bucket, String username, String password)
Creates aGenericQueryRequest
and mark it as containing a single simple statement (e.g. "SELECT * FROM default").- Parameters:
statement
- the N1QL query statement to perform.bucket
- the bucket on which to search.username
- the user authorized for bucket access.password
- the password for the user.- Returns:
- a
GenericQueryRequest
for this simple statement.
-
jsonQuery
public static GenericQueryRequest jsonQuery(String jsonQuery, String bucket, String password, String contextId)
Create aGenericQueryRequest
and mark it as containing a full N1QL query in Json form (including additional query parameters like named arguments, etc...). The simplest form of such a query is a single statement encapsulated in a json query object:{"statement":"SELECT * FROM default"}
.- Parameters:
jsonQuery
- the N1QL query in json form.bucket
- the bucket on which to perform the query.password
- the password for the target bucket.contextId
- the context id to store and use for tracing purposes.- Returns:
- a
GenericQueryRequest
for this full query.
-
jsonQuery
public static GenericQueryRequest jsonQuery(String jsonQuery, String bucket, String username, String password, String contextId, String statement)
Create aGenericQueryRequest
and mark it as containing a full N1QL query in Json form (including additional query parameters like named arguments, etc...). The simplest form of such a query is a single statement encapsulated in a json query object:{"statement":"SELECT * FROM default"}
.- Parameters:
jsonQuery
- the N1QL query in json form.bucket
- the bucket on which to perform the query.username
- the user authorized for bucket access.password
- the password for the user.contextId
- the context id to store and use for tracing purposes.- Returns:
- a
GenericQueryRequest
for this full query.
-
jsonQuery
public static GenericQueryRequest jsonQuery(String jsonQuery, String bucket, String password, String targetNode, String contextId)
Create aGenericQueryRequest
and mark it as containing a full N1QL query in Json form (including additional query parameters like named arguments, etc...). The simplest form of such a query is a single statement encapsulated in a json query object:{"statement":"SELECT * FROM default"}
.- Parameters:
jsonQuery
- the N1QL query in json form.bucket
- the bucket on which to perform the query.password
- the password for the target bucket.targetNode
- the node on which to execute this request (or null to let the core locate and choose one).contextId
- the context id to store and use for tracing purposes.- Returns:
- a
GenericQueryRequest
for this full query.
-
jsonQuery
public static GenericQueryRequest jsonQuery(String jsonQuery, String bucket, String username, String password, String targetNode, String contextId, String statement)
Create aGenericQueryRequest
and mark it as containing a full N1QL query in Json form (including additional query parameters like named arguments, etc...). The simplest form of such a query is a single statement encapsulated in a json query object:{"statement":"SELECT * FROM default"}
.- Parameters:
jsonQuery
- the N1QL query in json form.bucket
- the bucket on which to perform the query.username
- the user authorized for bucket access.password
- the password for the user.targetNode
- the node on which to execute this request (or null to let the core locate and choose one).contextId
- the context id to store and use for tracing purposes.statement
- the statement string.- Returns:
- a
GenericQueryRequest
for this full query.
-
-