Interface IStatement
An executable query. This represents either a SimpleStatement, a BoundStatement or a BoundStatement along with the query options (consistency level, whether to trace the query, ...).
Namespace: Dse
Assembly: Dse.dll
Syntax
public interface IStatement
Properties
AutoPage
Determines if the RowSet returned when executing this IStatement will automatically fetch the following result pages. Defaults to true.
Declaration
bool AutoPage { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ConsistencyLevel
Gets the consistency level for this query.
Declaration
ConsistencyLevel? ConsistencyLevel { get; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<ConsistencyLevel> |
IsIdempotent
Determines if this statement is idempotent, i.e. whether it can be applied multiple times without changing the result beyond the initial application.
Idempotence of the statement plays a role in ISpeculativeExecutionPolicy. If a statement is not idempotent, the driver will not schedule speculative executions for it.
When the property is null, the driver will use the default value from the GetDefaultIdempotence().Declaration
bool? IsIdempotent { get; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<System.Boolean> |
IsTracing
Gets whether tracing is enabled for this query or not.
Declaration
bool IsTracing { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Keyspace
Gets the keyspace this query operates on. The returned value should not be null only when the
IStatement applies to a different keyspace to the logged keyspace of the
ISession.
Declaration
string Keyspace { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
OutgoingPayload
Gets custom payload for that will be included when executing this Statement.
Declaration
IDictionary<string, byte[]> OutgoingPayload { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IDictionary<System.String, System.Byte[]> |
PageSize
Gets query's page size.
Declaration
int PageSize { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
PagingState
This object represents the next page to be fetched if the query is multi page. It can be saved and reused later on a different execution.
Declaration
byte[] PagingState { get; }
Property Value
| Type | Description |
|---|---|
| System.Byte[] |
QueryValues
Declaration
object[] QueryValues { get; }
Property Value
| Type | Description |
|---|---|
| System.Object[] |
ReadTimeoutMillis
Gets the per-host read timeout for this statement.
When the value is 0 or lower, the default value from the socket options will be used.
Declaration
int ReadTimeoutMillis { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
RetryPolicy
Gets the retry policy sets for this query, if any.
Declaration
IRetryPolicy RetryPolicy { get; }
Property Value
| Type | Description |
|---|---|
| IRetryPolicy |
RoutingKey
The routing key (in binary raw form) to use for token aware routing of this query.
The routing key is optional in the sense that implementers are
free to return null. The routing key is an hint used for token
aware routing (see
Declaration
RoutingKey RoutingKey { get; }
Property Value
| Type | Description |
|---|---|
| RoutingKey |
SerialConsistencyLevel
Gets the serial consistency level for the query.
The serial consistency level is only used by conditional updates (INSERT, UPDATE and DELETE with an IF condition).
Declaration
ConsistencyLevel SerialConsistencyLevel { get; }
Property Value
| Type | Description |
|---|---|
| ConsistencyLevel |
SkipMetadata
Declaration
bool SkipMetadata { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Timestamp
Gets the timestamp associated with this statement execution.
Declaration
DateTimeOffset? Timestamp { get; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<System.DateTimeOffset> |
Methods
DisableTracing()
Disable tracing for the statement.
Declaration
IStatement DisableTracing()
Returns
| Type | Description |
|---|---|
| IStatement |
EnableTracing(Boolean)
Enables tracing for the statement
Declaration
IStatement EnableTracing(bool enable = true)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | enable |
Returns
| Type | Description |
|---|---|
| IStatement |
ExecutingAs(String)
Allows this statement to be executed as a different user/role than the one currently authenticated (a.k.a. proxy execution).
Declaration
IStatement ExecutingAs(string userOrRole)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | userOrRole | The user or role name to act as when executing this statement. |
Returns
| Type | Description |
|---|---|
| IStatement | This statement |
Remarks
This feature is only available in DSE 5.1+.
SetAutoPage(Boolean)
Sets the paging behavior.
When set to true (default), the RowSet returned when executing this IStatement will automatically fetch the following result pages.
When false, the RowSet returned will only contain the rows contained in the result page and will not fetch additional pages.
Declaration
IStatement SetAutoPage(bool autoPage)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | autoPage |
Returns
| Type | Description |
|---|---|
| IStatement | this |
SetConsistencyLevel(Nullable<ConsistencyLevel>)
Sets the consistency level for the query.
The default consistency level, if this method is not called, is ConsistencyLevel.ONE.
Declaration
IStatement SetConsistencyLevel(ConsistencyLevel? consistency)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Nullable<ConsistencyLevel> | consistency | the consistency level to set. |
Returns
| Type | Description |
|---|---|
| IStatement | this |
SetIdempotence(Boolean)
Sets whether this statement is idempotent.
Idempotence of the statement plays a role in ISpeculativeExecutionPolicy. If a statement is not idempotent, the driver will not schedule speculative executions for it.
Declaration
IStatement SetIdempotence(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | value |
Returns
| Type | Description |
|---|---|
| IStatement |
SetOutgoingPayload(IDictionary<String, Byte[]>)
Sets a custom outgoing payload for this statement. Each time this statement is executed, this payload will be included in the request. Once it is set using this method, the payload should not be modified.
Declaration
IStatement SetOutgoingPayload(IDictionary<string, byte[]> payload)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IDictionary<System.String, System.Byte[]> | payload |
Returns
| Type | Description |
|---|---|
| IStatement |
SetPageSize(Int32)
Sets the page size for this query. The page size controls how much resulting rows will be retrieved simultaneously (the goal being to avoid loading too much results in memory for queries yielding large results). Please note that while value as low as 1 can be used, it is highly discouraged to use such a low value in practice as it will yield very poor performance. If in doubt, leaving the default is probably a good idea.
Also note that only SELECT queries ever make use of that
setting.
Query object.Declaration
IStatement SetPageSize(int pageSize)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | pageSize |
Returns
| Type | Description |
|---|---|
| IStatement |
SetPagingState(Byte[])
Sets the paging state, a token representing the current page state of query used to continue paging by retrieving the following result page. Setting the paging state will disable automatic paging.
Declaration
IStatement SetPagingState(byte[] pagingState)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | pagingState | The page state token |
Returns
| Type | Description |
|---|---|
| IStatement | this |
SetReadTimeoutMillis(Int32)
Overrides the default per-host read timeout ReadTimeoutMillis for this statement.
Declaration
IStatement SetReadTimeoutMillis(int timeout)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | timeout | Timeout in milliseconds. If the value is not greater than zero, the default value from the socket options will be used. |
Returns
| Type | Description |
|---|---|
| IStatement |
SetRetryPolicy(IRetryPolicy)
Sets the retry policy to use for this query.
Calling this method is only required when you want to override the default RetryPolicy set in the cluster configuration for this request or the one set in the execution profile (see RetryPolicy) for this request.
Use a IExtendedRetryPolicy implementation to cover all error scenarios.
Declaration
IStatement SetRetryPolicy(IRetryPolicy policy)
Parameters
| Type | Name | Description |
|---|---|---|
| IRetryPolicy | policy | The retry policy to use for this query. |
Returns
| Type | Description |
|---|---|
| IStatement | this IStatement instance. |
SetSerialConsistencyLevel(ConsistencyLevel)
Sets the serial consistency level for the query. The serial consistency level is only used by conditional updates (so INSERT, UPDATE and DELETE with an IF condition). For those, the serial consistency level defines the consistency level of the serial phase (or "paxos" phase) while the normal consistency level defines the consistency for the "learn" phase, i.e. what type of reads will be guaranteed to see the update right away. For instance, if a conditional write has a regular consistency of QUORUM (and is successful), then a QUORUM read is guaranteed to see that write. But if the regular consistency of that write is ANY, then only a read with a consistency of SERIAL is guaranteed to see it (even a read with consistency ALL is not guaranteed to be enough).
Declaration
IStatement SetSerialConsistencyLevel(ConsistencyLevel serialConsistency)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsistencyLevel | serialConsistency | Can be set only to ConsistencyLevel.Serial or ConsistencyLevel.LocalSerial. Setting it to ConsistencyLevel.Serial guarantees full linearizability while ConsistencyLevel.LocalSerial guarantees it only in the local datacenter. |
Returns
| Type | Description |
|---|---|
| IStatement | this |
SetTimestamp(DateTimeOffset)
Sets the timestamp associated with this statement execution. If provided, this will replace the server side assigned timestamp as default timestamp. Note that a timestamp in the query itself will still override this timestamp.
Declaration
IStatement SetTimestamp(DateTimeOffset value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.DateTimeOffset | value |
Returns
| Type | Description |
|---|---|
| IStatement |