aqlInsert.php
Table of Contents
Functions
- aqlInsert() : string
- Builds an AQL `INSERT` statement.
Functions
aqlInsert()
Builds an AQL `INSERT` statement.
aqlInsert([array<string|int, mixed> $init = [] ][, array<string|int, mixed>|null &$binds = null ][, string|null $queryID = null ]) : string
This method dynamically constructs an ArangoDB AQL query of the form:
INSERT {document} INTO collection OPTIONS {...} RETURN NEW
It supports binding collection names, attaching additional insert options, and optionally returning the newly inserted document.
The $init array may contain:
AQL::DOC(string) — The document to insert, written verbatim (default}).AQL::COLLECTION(string) — The target collection name.AQL::BIND_COLLECTION(string|null) — The NAME of the bind variable that carries the collection, without@(e.g.AQL::COLLECTION→@@collection). The collection is always bound : when omitted, a name is generated (@@c_<n>). Not a switch — a boolean is refused (BindException).AQL::QUERY_ID(string) — An optional query identifier to prepend the generated name of the bind collection variable.
The document is not formatted here : build it with aqlDocument(),
which takes the AQL::RAW_KEYS / AQL::RAW_VALUES / AQL::USE_SPACE options. This function reads none of them.
Parameters
- $init : array<string|int, mixed> = []
-
An associative array containing the insert parameters.
- $binds : array<string|int, mixed>|null = null
-
A reference array to hold bind variables for the query.
- $queryID : string|null = null
Tags
Return values
string —The compiled AQL INSERT query string, ready to be executed.