N1qlQuery
class N1qlQuery (View source)
Represents a N1QL query
Constants
NOT_BOUNDED |
This is the default (for single-statement requests). No timestamp vector is used in the index scan. This is also the fastest mode, because we avoid the cost of obtaining the vector, and we also avoid any wait for the index to catch up to the vector. |
REQUEST_PLUS |
This implements strong consistency per request. Before processing the request, a current vector is obtained. The vector is used as a lower bound for the statements in the request. If there are DML statements in the request, RYOW is also applied within the request. |
STATEMENT_PLUS |
This implements strong consistency per statement. Before processing each statement, a current vector is obtained and used as a lower bound for that statement. |
PROFILE_NONE |
Disables profiling. This is the default |
PROFILE_PHASES |
Enables phase profiling. |
PROFILE_TIMINGS |
Enables general timing profiling. |
Methods
Creates new N1qlQuery instance directly from the N1QL string.
Allows to pull credentials from the Authenticator
Specify array of positional parameters
Specify associative array of named parameters
Specifies the consistency level for this query
If set to true, it will signal the query engine on the server that only non-data modifying requests are allowed. Note that this rule is enforced on the server and not the SDK side.
Advanced: Maximum buffered channel size between the indexer client and the query service for index scans.
Advanced: Controls the number of items execution operators can batch for Fetch from the KV.
Advanced: Maximum number of items each execution operator can buffer between various operators.
Allows to override the default maximum parallelism for the query execution on the server side.
Details
static N1qlQuery
fromString(string $statement)
Creates new N1qlQuery instance directly from the N1QL string.
N1qlQuery
adhoc(bool $adhoc)
Allows to specify if this query is adhoc or not.
If it is not adhoc (so performed often), the client will try to perform optimizations transparently based on the server capabilities, like preparing the statement and then executing a query plan instead of the raw query.
N1qlQuery
crossBucket(bool $crossBucket)
Allows to pull credentials from the Authenticator
N1qlQuery
positionalParams(array $params)
Specify array of positional parameters
Previously specified positional parameters will be replaced.
Note: carefully choose type of quotes for the query string, because PHP also uses $
(dollar sign) for variable interpolation. If you are using double quotes, make sure
that N1QL parameters properly escaped.
N1qlQuery
namedParams(array $params)
Specify associative array of named parameters
The supplied array of key/value pairs will be merged with already existing named parameters.
Note: carefully choose type of quotes for the query string, because PHP also uses $
(dollar sign) for variable interpolation. If you are using double quotes, make sure
that N1QL parameters properly escaped.
N1qlQuery
consistency(int $consistency)
Specifies the consistency level for this query
N1qlQuery
profile(string $profileType)
Controls the profiling mode used during query execution
N1qlQuery
consistentWith(MutationState $state)
Sets mutation state the query should be consistent with
N1qlQuery
readonly(bool $readonly)
If set to true, it will signal the query engine on the server that only non-data modifying requests are allowed. Note that this rule is enforced on the server and not the SDK side.
Controls whether a query can change a resulting record set.
If readonly is true, then the following statements are not allowed:
- CREATE INDEX
- DROP INDEX
- INSERT
- MERGE
- UPDATE
- UPSERT
- DELETE
N1qlQuery
scanCap(int $scanCap)
Advanced: Maximum buffered channel size between the indexer client and the query service for index scans.
This parameter controls when to use scan backfill. Use 0 or a negative number to disable.
N1qlQuery
pipelineBatch(int $pipelineBatch)
Advanced: Controls the number of items execution operators can batch for Fetch from the KV.
N1qlQuery
pipelineCap(int $pipelineCap)
Advanced: Maximum number of items each execution operator can buffer between various operators.
N1qlQuery
maxParallelism(int $maxParallelism)
Allows to override the default maximum parallelism for the query execution on the server side.