Provides access to the results of an AQL query or another statement

The cursor might not contain all results in the beginning.

If the result set is too big to be transferred in one go, the cursor might issue additional HTTP requests to fetch the remaining results from the server.

package ArangoDBClient
since 0.2

 Methods

Initialise the cursor with the first results and some metadata

__construct(\ArangoDBClient\Connection $connection, array $data, array $options) 

Parameters

$connection

\ArangoDBClient\Connection
  • connection to be used

$data

array
  • initial result data as returned by the server

$options

array
  • cursor options

Exceptions

\ArangoDBClient\ClientException

Return the current result row, necessary for Iterator

current() : array

Returns

array- the current result row as an assoc array

Explicitly delete the cursor

delete() : boolean

This might issue an HTTP DELETE request to inform the server about the deletion.

Exceptions

\ArangoDBClient\Exception

Returns

boolean- true if the server acknowledged the deletion request, false otherwise

Get all results as an array

getAll() : array

This might issue additional HTTP requests to fetch any outstanding results from the server

Exceptions

\ArangoDBClient\Exception

Returns

array- an array of all results

Get the cached attribute for the result set

getCached() : boolean

Returns

boolean- whether or not the query result was served from the AQL query cache

Get the total number of results in the cursor

getCount() : integer

This might issue additional HTTP requests to fetch any outstanding results from the server

Exceptions

\ArangoDBClient\Exception

Returns

integer- total number of results

Return the extra data of the query (statistics etc.). Contents of the result array depend on the type of query executed

getExtra() : array

Returns

array

Return the number of HTTP calls that were made to build the cursor result

getFetches() : integer

Returns

integer

Return the number of documents filtered by the query

getFiltered() : integer

Returns

integer

Get the full count of the cursor (ignoring the outermost LIMIT)

getFullCount() : integer

Returns

integer- total number of results

Return the cursor id, if any

getId() : string

Returns

string

Return the number of documents iterated over in full scans

getScannedFull() : integer

Returns

integer

Return the number of documents iterated over in index scans

getScannedIndex() : integer

Returns

integer

Return the warnings issued during query execution

getWarnings() : array

Returns

array

Return the number of writes executed by the query

getWritesExecuted() : integer

Returns

integer

Return the number of ignored write operations from the query

getWritesIgnored() : integer

Returns

integer

Return the index of the current result row, necessary for Iterator

key() : integer

Returns

integer- the current result row index

Advance the cursor, necessary for Iterator

next() : void

Rewind the cursor, necessary for Iterator

rewind() : void

Sets the document class to use

setDocumentClass(string $class) : \ArangoDBClient\DocumentClassable
Inherited

Parameters

$class

string

Document class to use

Returns

\ArangoDBClient\DocumentClassable

Sets the edge class to use

setEdgeClass(string $class) : \ArangoDBClient\DocumentClassable
Inherited

Parameters

$class

string

Edge class to use

Returns

\ArangoDBClient\DocumentClassable

Check if cursor can be advanced further, necessary for Iterator

valid() : boolean

This might issue additional HTTP requests to fetch any outstanding results from the server

Exceptions

\ArangoDBClient\Exception

Returns

boolean- true if the cursor can be advanced further, false if cursor is at end

Create an array of results from the input array

add(array $data) : void

Parameters

$data

array
  • incoming result

Exceptions

\ArangoDBClient\ClientException

Create an array of common neighbors from the input array

addCommonNeighborsFromArray(array $data) : void

Parameters

$data

array
  • array of incoming "paths" arrays

Exceptions

\ArangoDBClient\ClientException

Create an array of common properties from the input array

addCommonPropertiesFromArray(array $data) : void

Parameters

$data

array
  • array of incoming "paths" arrays

Create an array of distances from the input array

addDistanceToFromArray(array $data) : void

Parameters

$data

array
  • array of incoming "paths" arrays

Create an array of documents from the input array

addDocumentsFromArray(array $data) : void

Parameters

$data

array
  • array of incoming "document" arrays

Exceptions

\ArangoDBClient\ClientException

Create an array of Edges from the input array

addEdgesFromArray(array $data) : void

Parameters

$data

array
  • array of incoming "edge" arrays

Exceptions

\ArangoDBClient\ClientException

Create an array of figuresfrom the input array

addFigureFromArray(array $data) : void

Parameters

$data

array
  • array of incoming "paths" arrays

Create an array of results from the input array

addFlatFromArray(array $data) : void

Parameters

$data

array
  • array of incoming results

Create an array of paths from the input array

addPathsFromArray(array $data) : void

Parameters

$data

array
  • array of incoming "paths" arrays

Exceptions

\ArangoDBClient\ClientException

Create an array of shortest paths from the input array

addShortestPathFromArray(array $data) : void

Parameters

$data

array
  • array of incoming "paths" arrays

Exceptions

\ArangoDBClient\ClientException

Create an array of Vertex from the input array

addVerticesFromArray(array $data) : void

Parameters

$data

array
  • array of incoming "vertex" arrays

Exceptions

\ArangoDBClient\ClientException

Fetch outstanding results from the server

fetchOutstanding() : void

Exceptions

\ArangoDBClient\Exception

Get a statistical figure value from the query result

getStatValue(string $name) : integer

Parameters

$name

string
  • name of figure to return

Returns

integer

Sanitize the result set rows

sanitize(array $rows) : array

This will remove the _id and _rev attributes from the results if the "sanitize" option is set

Parameters

$rows

array
  • array of rows to be sanitized

Returns

array- sanitized rows

Set the length of the (fetched) result set

updateLength() : void

Return the base URL for the cursor

url() : string

Returns

string

 Properties

 

Document class to use

$_documentClass : string

Default

'\ArangoDBClient\Document'
 

Edge class to use

$_edgeClass : string

Default

'\ArangoDBClient\Edge'
 

whether or not the query result was served from the AQL query result cache

$_cached 

Default

 

The connection object

$_connection : \ArangoDBClient\Connection

Default

 

precalculated number of documents in the cursor, as returned by the server

$_count : integer

Default

 

extra data (statistics) returned from the statement

$_extra : array

Default

 

number of HTTP calls that were made to build the cursor result

$_fetches 

Default

1
 

full count of the result set (ignoring the outermost LIMIT)

$_fullCount : integer

Default

 

"has more" indicator - if true, the server has more results

$_hasMore : boolean

Default

 

cursor id - might be NULL if cursor does not have an id

$_id : mixed

Default

 

total length of result set (in number of documents)

$_length : integer

Default

 

Cursor options

$_options : array

Default

 

current position in result set iteration (zero-based)

$_position : integer

Default

 

The result set

$_result : array

Default

 

Result Data

$data : array

Default

 Constants

 

"baseurl" option entry.

ENTRY_BASEURL = 'baseurl' 
 

cache option entry

ENTRY_CACHE = 'cache' 
 

cached result attribute - whether or not the result was served from the AQL query cache

ENTRY_CACHED = 'cached' 
 

result entry for extra data

ENTRY_EXTRA = 'extra' 
 

"flat" option entry (will treat the results as a simple array, not documents)

ENTRY_FLAT = '_flat' 
 

result entry for "hasMore" flag

ENTRY_HASMORE = 'hasMore' 
 

result entry for cursor id

ENTRY_ID = 'id' 
 

result entry for result documents

ENTRY_RESULT = 'result' 
 

sanitize option entry

ENTRY_SANITIZE = '_sanitize' 
 

result entry for stats

ENTRY_STATS = 'stats' 
 

"objectType" option entry.

ENTRY_TYPE = 'objectType' 
 

result entry for the full count (ignoring the outermost LIMIT)

FULL_COUNT = 'fullCount'