Skip to content

Commit b27f542

Browse files
committed
update examples
1 parent a3031ae commit b27f542

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

UNITTESTS.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/aql-query.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,26 @@
4343

4444
foreach ($statements as $query => $bindVars) {
4545
$statement = new Statement($connection, [
46-
'query' => $query,
47-
'count' => true,
48-
'batchSize' => 1000,
49-
'bindVars' => $bindVars,
50-
'sanitize' => true,
46+
'query' => $query,
47+
'count' => true,
48+
'batchSize' => 1000,
49+
'bindVars' => $bindVars,
50+
'profile' => false, // turn this on for query profiling
51+
'memoryLimit' => 16 * 1024 * 1024, // optional server-side memory limit for query
52+
'maxRuntime' => 10.0, // optional server-side runtime for query
53+
'sanitize' => true,
54+
'_flat' => false, // set this to true when the query result is not an array of documents
55+
5156
]
5257
);
5358

5459
echo 'RUNNING STATEMENT ' . $statement . PHP_EOL;
5560

5661
$cursor = $statement->execute();
62+
63+
// get information about query runtime, peak memory usage etc.
64+
// var_dump($cursor->getExtra());
65+
5766
foreach ($cursor->getAll() as $doc) {
5867
echo '- RETURN VALUE: ' . json_encode($doc) . PHP_EOL;
5968
}

examples/batch.php

Lines changed: 0 additions & 2 deletions
This file was deleted.

examples/init.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,20 @@
4444
// ConnectionOptions::OPTION_ENDPOINT => 'unix:///tmp/arangodb.sock', // UNIX domain socket
4545

4646
ConnectionOptions::OPTION_CONNECTION => 'Keep-Alive', // can use either 'Close' (one-time connections) or 'Keep-Alive' (re-used connections)
47-
ConnectionOptions::OPTION_AUTH_TYPE => 'Basic', // use basic authorization
4847

49-
// authentication parameters (note: must also start server with option `--server.disable-authentication false`)
50-
ConnectionOptions::OPTION_AUTH_USER => 'root', // user for basic authorization
51-
ConnectionOptions::OPTION_AUTH_PASSWD => '', // password for basic authorization
48+
// authentication parameters
49+
ConnectionOptions::OPTION_AUTH_TYPE => 'Basic', // use HTTP Basic authorization
50+
ConnectionOptions::OPTION_AUTH_USER => 'root', // user for Basic authorization
51+
ConnectionOptions::OPTION_AUTH_PASSWD => '', // password for Basic authorization
52+
53+
// in order to not send passwords, it is possible to make the driver generate a JWT for an existing user.
54+
// this requires knowledge of the server's JWT secret key, however:
55+
// ConnectionOptions::OPTION_AUTH_TYPE => 'Bearer', // use HTTP Bearer authorization
56+
// ConnectionOptions::OPTION_AUTH_USER => 'root', // user name
57+
// ConnectionOptions::OPTION_AUTH_PASSWD => '', // server's JWT secret needs to go in here
58+
59+
// in order to use an externally generated JWT, there is no need to specify user and passwd, but just the JWT value:
60+
// ConnectionOptions::OPTION_AUTH_JWT => '', // use an externally generated JWT for authorization
5261

5362
ConnectionOptions::OPTION_TIMEOUT => 30, // timeout in seconds
5463
// ConnectionOptions::OPTION_TRACE => $traceFunc, // tracer function, can be used for debugging

0 commit comments

Comments
 (0)