Compare commits

..

2 Commits

Author SHA1 Message Date
Arsen Mirzaev Tatyano-Muradovich 453cac0b77 resolved #1 2025-02-13 08:52:44 +03:00
Arsen Mirzaev Tatyano-Muradovich 3e095e14f7 return values fix 2024-10-12 19:21:25 +03:00
2 changed files with 10 additions and 7 deletions

View File

@ -12,7 +12,8 @@ use mirzaev\arangodb\connection,
// Library for ArangoDB
use ArangoDBClient\Statement as _statement,
ArangoDBClient\Document as _document,
ArangoDBClient\CollectionHandler as _collection_handler;
ArangoDBClient\CollectionHandler as _collection_handler,
ArangoDBClient\Cursor as cursor;
// Built-in libraries
use exception;
@ -85,11 +86,12 @@ class collection
*
* @param string $query Query (AQL)
* @param array $parameters Binded parameters for placeholders [placholder => parameter]
* @param bool $flat Not implement record?
* @param array &$errors Registry of errors
*
* @return _document|array|string|int|null Instance of the document
*/
public static function execute(string $query, array $parameters = [], array &$errors = []): _document|string|array|int|null
public static function execute(string $query, array $parameters = [], bool $flat = false, array &$errors = []): _document|string|array|int|null
{
try {
// Statement instance initialization
@ -97,8 +99,9 @@ class collection
connection::$session,
[
'query' => $query,
"batchSize" => 1000,
"sanitize" => true
'batchSize' => 1000,
'sanitize' => true,
cursor::ENTRY_FLAT => $flat
]
);
@ -179,10 +182,10 @@ class collection
// Count and exit (success)
return static::execute(
<<<'AQL'
RETURN LENGTH(@collection)
RETURN LENGTH(@@collection)
AQL,
[
'collection' => $collection
'@collection' => $collection
]
);
} catch (exception $e) {

View File

@ -51,7 +51,7 @@ class document
bool $check = false,
?terminal $terminal = null,
array &$errors = []
): ?string {
): string|null|false {
try {
// Инициализация коллекции
collection::initialize($collection, isset($data['_from'], $data['_to']) ? type::edge : type::document);