Session
interface Session (View source)
A session is used to prepare and execute statements.
Methods
Execute a query asynchronously. This method returns immediately, but the query continues execution in the background.
Asynchronously prepare a query for execution.
Close the session and all its connections.
Asynchronously close the session and all its connections.
Get performance and diagnostic metrics.
Details
Rows
execute(string|Statement $statement, array|ExecutionOptions|null $options)
Execute a query.
Available execution options: | Option Name | Option Type | Option Details |
---|---|---|---|
arguments | array | An array or positional or named arguments | |
consistency | int | A consistency constant e.g Dse::CONSISTENCY_ONE, Dse::CONSISTENCY_QUORUM, etc. | |
timeout | int | A number of rows to include in result for paging | |
paging_state_token | string | A string token use to resume from the state of a previous result set | |
retry_policy | RetryPolicy | A retry policy that is used to handle server-side failures for this request | |
serial_consistency | int | Either Dse::CONSISTENCY_SERIAL or Dse::CONSISTENCY_LOCAL_SERIAL | |
timestamp | int|string | Either an integer or integer string timestamp that represents the number of microseconds since the epoch | |
execute_as | string | User to execute statement as |
FutureRows
executeAsync(string|Statement $statement, array|ExecutionOptions|null $options)
Execute a query asynchronously. This method returns immediately, but the query continues execution in the background.
PreparedStatement
prepare(string $cql, array|ExecutionOptions|null $options)
Prepare a query for execution.
FuturePreparedStatement
prepareAsync(string $cql, array|ExecutionOptions|null $options)
Asynchronously prepare a query for execution.
null
close(float $timeout)
Close the session and all its connections.
FutureClose
closeAsync()
Asynchronously close the session and all its connections.
array
metrics()
Get performance and diagnostic metrics.
Schema
schema()
Get a snapshot of the cluster's current schema.