ENTRY_QUERY
ENTRY_QUERY
Query string index
Container for a read-only ("select") statement
A statement is an AQL query that can be issued to the server. Optional bind parameters can be used when issuing the statement to separate the statement from the values. Executing a statement 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
a list of documents as its result. The result can be treated as a list of
documents, and the document can be updated and sent back to the server by
the client.
However, the query "RETURN 1 + 1" will not produce a list of documents as
its result, but a list 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:
$_connection : \triagens\ArangoDb\Connection
The connection object
$_bindVars : \triagens\ArangoDb\BindVars
The bind variables and values used for the statement
__construct(\triagens\ArangoDb\Connection $connection, array $data)
Initialise the statement
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.
\triagens\ArangoDb\Connection | $connection |
|
array | $data |
|
execute() : \triagens\ArangoDb\Cursor
Execute the statement
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.
__invoke(mixed $args) : \triagens\ArangoDb\Cursor
Invoke the statement
This will simply call execute(). Arguments are ignored.
mixed | $args |
|
bind(mixed $key, mixed $value) : void
Bind a parameter to the statement
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 | $key |
|
mixed | $value |
|
setBatchSize(integer $value) : void
Set the batch size for the statement
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 | $value |
|
getConnection() : \triagens\ArangoDb\Connection
Return the connection object