Container for an AQL query
Optional bind parameters can be used when issuing the AQL query to separate the query from the values. Executing a query will result in a cursor being created.
There is an important distinction between two different types of statements:
For example, a statement such as "FOR e IN example RETURN e" will produce
an array of documents as its result. The result can be treated as an array of
documents, and each document can be updated and sent back to the server by
the client.
However, the query "RETURN 1 + 1" will not produce an array of documents as
its result, but an array with a single scalar value (the number 2).
"2" is not a valid document so creating a document from it will fail.
To turn the results of this query into a document, the following needs to
be done:
package | ArangoDBClient |
---|---|
since | 0.2 |
__construct(\ArangoDBClient\Connection $connection, array $data)
The $data property can be used to specify the query text and further options for the query.
An important consideration when creating a statement is whether the statement will produce a list of documents as its result or any other non-document value. When a statement is created, by default it is assumed that the statement will produce documents. If this is not the case, executing a statement that returns non-documents will fail.
To explicitly mark the statement as returning non-documents, the '_flat' option should be specified in $data.
\ArangoDBClient\Connection
array
\ArangoDBClient\Exception |
---|
__invoke(mixed $args) : \ArangoDBClient\Cursor
This will simply call execute(). Arguments are ignored.
mixed
\ArangoDBClient\Exception |
---|
\ArangoDBClient\Cursor
- the result cursor__toString() : string
string
- the current query stringbind(mixed $key, mixed $value = null
) : void
This method can either be called with a string $key and a separate value in $value, or with an array of all bind bind parameters in $key, with $value being NULL.
Allowed value types for bind parameters are string, int, double, bool and array. Arrays must not contain any other than these types.
mixed
mixed
\ArangoDBClient\Exception |
---|
execute() : \ArangoDBClient\Cursor
This will post the query to the server and return the results as a Cursor. The cursor can then be used to iterate the results.
\ArangoDBClient\Exception |
---|
\ArangoDBClient\Cursor
explain() : array
This will post the query to the server and return the execution plan as an array.
\ArangoDBClient\Exception |
---|
array
getBatchSize() : integer
integer
- current batch size valuegetBindVars() : array
array
- array of bind variables/valuesgetCache() : boolean
boolean
- current value of 'cache' optiongetCount() : boolean
boolean
- current value of count optiongetFailOnWarning() : boolean
boolean
- current value of fail-on-warning optiongetFullCount() : boolean
boolean
- current value of full count optiongetMemoryLimit() : integer
integer
- current value of memory limit optiongetQuery() : string
string
- current query string valuegetStream() : boolean
boolean
- current value of stream optiongetTtl() : double
double
- current value of ttl optionsetBatchSize(integer $value) : void
The batch size is the number of results to be transferred in one server round-trip. If a query produces more results than the batch size, it creates a server-side cursor that provides the additional results.
The server-side cursor can be accessed by the client with subsequent HTTP requests.
integer
\ArangoDBClient\ClientException |
---|
setCache(boolean $value) : void
boolean
setCount(boolean $value) : void
boolean
setDocumentClass(string $class) : \ArangoDBClient\Statement
string
Document class to use
\ArangoDBClient\Statement
setFailOnWarning(boolean $value = true
) : void
boolean
setFullCount(boolean $value) : void
boolean
setMemoryLimit(integer $value) : void
integer
setQuery(string $query) : void
string
\ArangoDBClient\ClientException |
---|
setResultType($resultType) : string
string
- resultType of the querysetStream(boolean $value) : void
boolean
setTtl(double $value) : void
double
validate() : array
This will post the query to the server for validation and return the validation result as an array.
\ArangoDBClient\Exception |
---|
array
getConnection() : \ArangoDBClient\Connection
\ArangoDBClient\Connection
- the connection objectbuildData() : array
array
- array of data to be sent to servergetCursorOptions() : array
array
- array of options$_documentClass
$_batchSize : mixed
$_bindVars : \ArangoDBClient\BindVars
$_cache : boolean
$_connection : \ArangoDBClient\Connection
$_doCount : boolean
false
$_failOnWarning : boolean
false
$_flat : boolean
false
$_fullCount : boolean
false
$_memoryLimit : integer
0
$_query : string
$_retries : boolean
0
$_sanitize : boolean
false
$_stream : boolean
$_trxId : string
null
$_ttl : double
$resultType : string
ENTRY_BATCHSIZE = 'batchSize'
ENTRY_BINDVARS = 'bindVars'
ENTRY_COUNT = 'count'
ENTRY_FAIL_ON_WARNING = 'failOnWarning'
ENTRY_MEMORY_LIMIT = 'memoryLimit'
ENTRY_QUERY = 'query'
ENTRY_RETRIES = 'retries'
ENTRY_STREAM = 'stream'
ENTRY_TRANSACTION = 'transaction'
ENTRY_TTL = 'ttl'
FULL_COUNT = 'fullCount'