• DataStax C# Driver for Apache Cassandra API Documentation
Search Results for

    Show / Hide Table of Contents
    • Cassandra
      • AesColumnEncryptionPolicy
      • AesColumnEncryptionPolicy.AesKeyAndIV
      • AggregateMetadata
      • AlreadyExistsException
      • AtomicMonotonicTimestampGenerator
      • AtomicMonotonicWinApiTimestampGenerator
      • AuthenticationException
      • BaseColumnEncryptionPolicy<TKey>
      • BaseColumnEncryptionPolicy<TKey>.ColMetadataKey
      • BatchStatement
      • BatchType
      • BigIntegerTypeAdapter
      • BoundStatement
      • Builder
      • BusyPoolException
      • CassandraConnectionStringBuilder
      • ClientOptions
      • Cluster
      • ColumnDesc
      • ColumnEncryptionInvalidTypeError
      • ColumnEncryptionMetadata
      • ColumnTypeCode
      • CompressionType
      • Configuration
      • ConsistencyLevel
      • ConstantReconnectionPolicy
      • ConstantSpeculativeExecutionPolicy
      • CqlColumn
      • CqlVector<T>
      • CustomColumnInfo
      • DCAwareRoundRobinPolicy
      • DataCollectionMetadata
      • DataCollectionMetadata.SortOrder
      • DecimalTypeAdapter
      • DefaultLoadBalancingPolicy
      • DefaultRetryPolicy
      • Diagnostics
      • DowngradingConsistencyRetryPolicy
      • DriverException
      • DriverInternalError
      • Duration
      • DynamicCompositeTypeAdapter
      • EC2MultiRegionTranslator
      • EncryptedValue
      • ExecutionException
      • ExecutionInfo
      • ExponentialReconnectionPolicy
      • Extensions
      • FallthroughRetryPolicy
      • FixedReconnectionPolicy
      • FunctionFailureException
      • FunctionMetadata
      • GraphProtocol
      • Host
      • HostDistance
      • HostsEventArgs
      • HostsEventArgs.Kind
      • HostsEventHandler
      • IAddressTranslator
      • IAuthProvider
      • IAuthenticator
      • ICluster
      • IColumnEncryptionPolicy
      • IColumnInfo
      • IExecutionProfile
      • IExecutionProfileBuilder
      • IExecutionProfileOptions
      • IExtendedRetryPolicy
      • IFrameCompressor
      • IInitializer
      • ILoadBalancingPolicy
      • IReconnectionPolicy
      • IReconnectionSchedule
      • IRequestTracker
      • IRetryPolicy
      • ISession
      • ISessionState
      • ISpeculativeExecutionPlan
      • ISpeculativeExecutionPolicy
      • IStatement
      • ITimestampGenerator
      • ITypeAdapter
      • IdempotenceAwareRetryPolicy
      • IndexMetadata
      • IndexMetadata.IndexKind
      • InitFatalErrorException
      • InvalidConfigurationInQueryException
      • InvalidQueryException
      • InvalidTypeException
      • IsBootstrappingException
      • KeyType
      • KeyspaceMetadata
      • ListColumnInfo
      • LocalDate
      • LocalTime
      • Logger
      • LoggingRetryPolicy
      • MapColumnInfo
      • MaterializedViewMetadata
      • Metadata
      • MetadataSyncOptions
      • MetricsExtensions
      • MonitorReportingOptions
      • NoHostAvailableException
      • NoSpeculativeExecutionPolicy
      • NodeRequestInfo
      • NoneAuthProvider
      • NullTypeAdapter
      • OperationTimedOutException
      • OverloadedException
      • PlainTextAuthProvider
      • Policies
      • PoolingOptions
      • PrepareRequest
      • PreparedQueryNotFoundException
      • PreparedStatement
      • PreparedStatementIdMismatchException
      • ProtocolErrorException
      • ProtocolOptions
      • ProtocolVersion
      • QueryExecutionException
      • QueryOptions
      • QueryProtocolOptions
      • QueryProtocolOptions.QueryFlags
      • QueryTimeoutException
      • QueryTrace
      • QueryTrace.Event
      • QueryValidationException
      • ReadFailureException
      • ReadTimeoutException
      • RegularStatement
      • ReplicationStrategies
      • RequestInvalidException
      • RetryDecision
      • RetryDecision.RetryDecisionType
      • RetryLoadBalancingPolicy
      • RetryLoadBalancingPolicyEventArgs
      • RoundRobinPolicy
      • RoutingKey
      • Row
      • RowSet
      • RowSetMetadata
      • SSLOptions
      • SchemaChangedEventArgs
      • SchemaChangedEventArgs.Kind
      • SchemaChangedEventHandler
      • ServerErrorException
      • Session
      • SessionRequestInfo
      • SetColumnInfo
      • SimpleStatement
      • SocketOptions
      • Statement
      • SyntaxError
      • TableColumn
      • TableMetadata
      • TableOptions
      • TimeUuid
      • ToManyConnectionsPerHost
      • TokenAwarePolicy
      • TraceRetrievalException
      • TruncateException
      • TupleColumnInfo
      • TypeAdapters
      • UdtColumnInfo
      • UdtMap
      • UdtMap<T>
      • UdtMappingDefinitions
      • UnauthorizedException
      • UnavailableException
      • Unset
      • VectorColumnInfo
      • WriteFailureException
      • WriteTimeoutException
    • Cassandra.AppMetrics
      • DriverAppMetricsOptions
    • Cassandra.AppMetrics.MetricTypes
      • IAppMetricsCounter
      • IAppMetricsGauge
      • IAppMetricsMeter
      • IAppMetricsMetric
      • IAppMetricsTimer
    • Cassandra.AppMetrics.MetricValues
      • IAppMetricsHistogramValue
      • IAppMetricsMeterValue
      • IAppMetricsMetricWithValue<T>
      • IAppMetricsTimerValue
    • Cassandra.Data
      • CqlBatchTransaction
      • CqlCommand
      • CqlConnection
      • CqlDataAdapter
      • CqlParameter
      • CqlParameterCollection
      • CqlProviderFactory
      • CqlReader
    • Cassandra.Data.Linq
      • AllowFilteringAttribute
      • Batch
      • ClusteringKeyAttribute
      • ColumnAttribute
      • CompactStorageAttribute
      • CounterAttribute
      • CqlArgumentException
      • CqlCommand
      • CqlConditionalCommand<TEntity>
      • CqlDelete
      • CqlFunction
      • CqlInsert<TEntity>
      • CqlLinqNotSupportedException
      • CqlOperator
      • CqlQueryBase<TEntity>
      • CqlQueryExtensions
      • CqlQuerySingleElement<TEntity>
      • CqlQuery<TEntity>
      • CqlScalar<TEntity>
      • CqlToken
      • CqlUpdate
      • ITable
      • IgnoreAttribute
      • PartitionKeyAttribute
      • SecondaryIndexAttribute
      • SessionExtensions
      • StaticColumnAttribute
      • TableAttribute
      • TableType
      • Table<TEntity>
    • Cassandra.DataStax.Auth
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
    • Cassandra.DataStax.Auth.Sspi
      • SspiException
    • Cassandra.DataStax.Graph
      • Direction
      • Edge
      • Element
      • ElementMap
      • EnumWrapper
      • FluentGraphStatement
      • GraphNode
      • GraphOptions
      • GraphResultSet
      • GraphStatement
      • IEdge
      • IElement
      • IGraphNode
      • IGraphStatement
      • IPath
      • IProperty
      • IPropertyWithElement
      • IVertex
      • IVertexProperty
      • Path
      • SimpleGraphStatement
      • TEnum
      • Traverser
      • Vertex
    • Cassandra.DataStax.Graph.Internal
      • IGraphSONDeserializer
      • IGraphSONReader
      • IGraphSONSerializer
      • IGraphSONWriter
    • Cassandra.DataStax.Search
      • DateRange
      • DateRangeBound
      • DateRangePrecision
    • Cassandra.Geometry
      • GeometryBase
      • LineString
      • Point
      • Polygon
    • Cassandra.Mapping
      • AppliedInfo<T>
      • ColumnMap
      • Cql
      • CqlQueryOptions
      • IColumnDefinition
      • ICqlBatch
      • ICqlQueryAsyncClient
      • ICqlQueryClient
      • ICqlWriteAsyncClient
      • ICqlWriteClient
      • IMapper
      • IPage<T>
      • ITypeDefinition
      • Map<TPoco>
      • Mapper
      • MappingConfiguration
      • Mappings
      • PrimaryKeyAttribute
      • SortOrder
      • TableNameAttribute
    • Cassandra.Mapping.Attributes
      • ClusteringKeyAttribute
      • ColumnAttribute
      • CounterAttribute
      • FrozenAttribute
      • FrozenKeyAttribute
      • FrozenValueAttribute
      • IgnoreAttribute
      • PartitionKeyAttribute
      • SecondaryIndexAttribute
      • StaticColumnAttribute
      • TableAttribute
    • Cassandra.Mapping.TypeConversion
      • DefaultTypeConverter
      • EnumStringMapper<T>
      • NullableEnumStringMapper<T>
      • TypeConverter
    • Cassandra.Mapping.Utils
      • MemberInfoExtensions
    • Cassandra.Metrics
      • DriverMetricsOptions
      • IDriverMetrics
      • IMetric
      • IMetricsRegistry<TMetric>
      • NodeMetric
      • NodeMetric.Counters
      • NodeMetric.Gauges
      • NodeMetric.Meters
      • NodeMetric.Timers
      • SessionMetric
      • SessionMetric.Counters
      • SessionMetric.Gauges
      • SessionMetric.Meters
      • SessionMetric.Timers
    • Cassandra.Metrics.Abstractions
      • IDriverCounter
      • IDriverGauge
      • IDriverMeter
      • IDriverMetric
      • IDriverMetricsProvider
      • IDriverTimer
    • Cassandra.OpenTelemetry
      • BuilderExtensions
      • CassandraActivitySourceHelper
      • CassandraInstrumentationOptions
      • OpenTelemetryRequestTracker
    • Cassandra.Serialization
      • CustomTypeSerializer<T>
      • TypeSerializer
      • TypeSerializerDefinitions
      • TypeSerializer<T>
      • UdtSerializer
    • Cassandra.Serialization.Primitive
      • DecimalSerializer

    Class SimpleStatement

    A simple IStatement implementation built directly from a query string.

    Inheritance
    object
    Statement
    RegularStatement
    SimpleStatement
    CqlCommand
    Implements
    IStatement
    Inherited Members
    RegularStatement.ToString()
    Statement.ProxyExecuteKey
    Statement.QueryValues
    Statement.SkipMetadata
    Statement.ConsistencyLevel
    Statement.SerialConsistencyLevel
    Statement.PageSize
    Statement.IsTracing
    Statement.ReadTimeoutMillis
    Statement.RetryPolicy
    Statement.PagingState
    Statement.Timestamp
    Statement.AutoPage
    Statement.OutgoingPayload
    Statement.IsIdempotent
    Statement.Host
    Statement.ExecutingAs(string)
    Statement.SetAutoPage(bool)
    Statement.SetPagingState(byte[])
    Statement.SetReadTimeoutMillis(int)
    Statement.SetConsistencyLevel(ConsistencyLevel?)
    Statement.SetSerialConsistencyLevel(ConsistencyLevel)
    Statement.SetTimestamp(DateTimeOffset)
    Statement.EnableTracing(bool)
    Statement.DisableTracing()
    Statement.SetRetryPolicy(IRetryPolicy)
    Statement.SetIdempotence(bool)
    Statement.SetPageSize(int)
    Statement.SetOutgoingPayload(IDictionary<string, byte[]>)
    Statement.SetHost(Host)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Cassandra
    Assembly: Cassandra.dll
    Syntax
    public class SimpleStatement : RegularStatement, IStatement

    Constructors

    SimpleStatement()

    Creates a new instance of SimpleStatement without any query string or parameters.

    Declaration
    public SimpleStatement()

    SimpleStatement(IDictionary<string, object>, string)

    Creates a new instance of SimpleStatement using a dictionary of parameters and a query with named parameters.

    Declaration
    public SimpleStatement(IDictionary<string, object> valuesDictionary, string query)
    Parameters
    Type Name Description
    IDictionary<string, object> valuesDictionary

    A dictionary containing the query parameters values using the parameter name as keys.

    string query

    The cql query string.

    Remarks

    This constructor is valid for dynamically-sized named parameters, consider using anonymous types for fixed-size named parameters.

    Examples
    const string query = "INSERT INTO users (id, name, email) VALUES (:id, :name, :email)";
    var parameters = new Dictionary<string, object> 
    {
      { "id", id },
      { "name", name },
      { "email", email },
    };
    var statement = new SimpleStatement(parameters, query);
    See Also
    SimpleStatement(string, params object[])

    SimpleStatement(string)

    Creates a new instance of SimpleStatement with the provided CQL query.

    Declaration
    public SimpleStatement(string query)
    Parameters
    Type Name Description
    string query

    The cql query string.

    SimpleStatement(string, params object[])

    Creates a new instance of SimpleStatement with the provided CQL query and values provided.

    Declaration
    public SimpleStatement(string query, params object[] values)
    Parameters
    Type Name Description
    string query

    The cql query string.

    object[] values

    Parameter values required for the execution of query.

    Examples

    Using positional parameters:

    const string query = "INSERT INTO users (id, name, email) VALUES (?, ?, ?)";
    var statement = new SimpleStatement(query, id, name, email);

    Using named parameters (using anonymous objects):

    const string query = "INSERT INTO users (id, name, email) VALUES (:id, :name, :email)";
    var statement = new SimpleStatement(query, new { id, name, email } );

    Properties

    Keyspace

    Returns the keyspace this query operates on, as set using SetKeyspace(string)

    The keyspace returned is used as a hint for token-aware routing.

    Declaration
    public override string Keyspace { get; }
    Property Value
    Type Description
    string
    Overrides
    Statement.Keyspace
    Remarks

    Consider using a ISession connected to single keyspace using Connect(string).

    QueryString

    Gets the query string.

    Declaration
    public override string QueryString { get; }
    Property Value
    Type Description
    string
    Overrides
    RegularStatement.QueryString

    RoutingKey

    Gets the routing key for the query.

    Routing key can be provided using the SetRoutingValues(params object[]) method.

    Declaration
    public override RoutingKey RoutingKey { get; }
    Property Value
    Type Description
    RoutingKey
    Overrides
    Statement.RoutingKey

    Methods

    Bind(params object[])

    Sets the parameter values for the query.

    The same amount of values must be provided as parameter markers in the query.

    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.

    Declaration
    [Obsolete("The method Bind() is deprecated, use SimpleStatement constructor parameters to provide query values")]
    public SimpleStatement Bind(params object[] values)
    Parameters
    Type Name Description
    object[] values
    Returns
    Type Description
    SimpleStatement

    BindObjects(object[])

    Declaration
    [Obsolete("The method BindObject() is deprecated, use SimpleStatement constructor parameters to provide query values")]
    public SimpleStatement BindObjects(object[] values)
    Parameters
    Type Name Description
    object[] values
    Returns
    Type Description
    SimpleStatement

    SetKeyspace(string)

    Sets the keyspace this Statement operates on. The keyspace should only be set when the IStatement applies to a different keyspace to the logged keyspace of the ISession.

    Declaration
    public SimpleStatement SetKeyspace(string name)
    Parameters
    Type Name Description
    string name

    The keyspace name.

    Returns
    Type Description
    SimpleStatement

    SetQueryString(string)

    Declaration
    public SimpleStatement SetQueryString(string queryString)
    Parameters
    Type Name Description
    string queryString
    Returns
    Type Description
    SimpleStatement

    SetRoutingKey(params RoutingKey[])

    Set the routing key for this query.

    This method allows to manually provide a routing key for this query. It is thus optional since the routing key is only an hint for token aware load balancing policy but is never mandatory.

    If the partition key for the query is composite, use the

    #setRoutingKey(ByteBuffer...) method instead to build the routing key.
    Declaration
    public SimpleStatement SetRoutingKey(params RoutingKey[] routingKeyComponents)
    Parameters
    Type Name Description
    RoutingKey[] routingKeyComponents

    the raw (binary) values to compose to obtain the routing key.

    Returns
    Type Description
    SimpleStatement

    this SimpleStatement object. Query#getRoutingKey

    SetRoutingValues(params object[])

    Sets the partition key values in order to route the query to the correct replicas.

    For simple partition keys, set the partition key value.

    For composite partition keys, set the multiple the partition key values in correct order.

    Declaration
    public SimpleStatement SetRoutingValues(params object[] keys)
    Parameters
    Type Name Description
    object[] keys
    Returns
    Type Description
    SimpleStatement

    Implements

    IStatement
    Back to top © DataStax, All rights reserved.