Click or drag to resize
PreparedStatement Class
Represents a prepared statement, a query with bound variables that has been prepared (pre-parsed) by the database.

A prepared statement can be executed once concrete values has been provided for the bound variables. The pair of a prepared statement and values for its bound variables is a BoundStatement and can be executed (by Session#Execute).

Inheritance Hierarchy
SystemObject
  CassandraPreparedStatement

Namespace: Cassandra
Assembly: Cassandra (in Cassandra.dll) Version: 3.2.0
Syntax
C#
public class PreparedStatement

The PreparedStatement type exposes the following members.

Constructors
  NameDescription
Public methodPreparedStatement
Initializes a new instance of the Cassandra.PreparedStatement class
Top
Methods
  NameDescription
Public methodBind
Creates a new BoundStatement object and bind its variables to the provided values.

Specify the parameter values by the position of the markers in the query or by name, using a single instance of an anonymous type, with property names as parameter names.

Note that while no more values than bound variables can be provided, it is allowed to provide less values that there is variables.

Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodSetConsistencyLevel
Sets a default consistency level for all BoundStatement created from this object.

If no consistency level is set through this method, the BoundStatement created from this object will use the default consistency level (One).

Changing the default consistency level is not retroactive, it only applies to BoundStatement created after the change.

Public methodSetIdempotence
Sets whether the prepared statement is idempotent.

Idempotence of the query plays a role in ISpeculativeExecutionPolicy. If a query is not idempotent, the driver will not schedule speculative executions for it.

Public methodSetOutgoingPayload
Sets a custom outgoing payload for this statement. Each time an statement generated using this prepared statement is executed, this payload will be included in the request. Once it is set using this method, the payload should not be modified.
Public methodSetRoutingKey
Set the routing key for this query.

The routing key is a hint for token aware load balancing policies but is never mandatory. This method allows you to manually provide a routing key for this query.

Use this method ONLY if the partition keys are the same for all query executions (hard-coded parameters).

If the partition key is composite, you should provide multiple routing key components.

Public methodSetRoutingNames
For named query markers, it sets the parameter names that are part of the routing key.

Use this method ONLY if the parameter names are different from the partition key names.

Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyConsistencyLevel
Gets the default consistency level for all executions using this instance
Public propertyIncomingPayload
Gets the the incoming payload, that is, the payload that the server sent back with its prepared response, or null if the server did not include any custom payload.
Public propertyIsIdempotent
Determines if the query is idempotent, i.e. whether it can be applied multiple times without changing the result beyond the initial application.

Idempotence of the prepared statement plays a role in ISpeculativeExecutionPolicy. If a query 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.
Public propertyOutgoingPayload
Gets custom payload for that will be included when executing an Statement.
Public propertyRoutingIndexes
Gets or sets the parameter indexes that are part of the partition key
Public propertyRoutingKey
Gets the routing key for the prepared statement.
Public propertyVariables
Gets metadata on the bounded variables of this prepared statement.
Top
See Also