• DataStax Enterprise C# Driver API Documentation

    Show / Hide Table of Contents
    • Dse
      • AggregateMetadata
      • AlreadyExistsException
      • AtomicMonotonicTimestampGenerator
      • AtomicMonotonicWinApiTimestampGenerator
      • AuthenticationException
      • BatchStatement
      • BatchType
      • BigIntegerTypeAdapter
      • BoundStatement
      • Builder
      • BusyPoolException
      • CassandraConnectionStringBuilder
      • ClientOptions
      • Cluster
      • ColumnDesc
      • ColumnTypeCode
      • CompressionType
      • Configuration
      • ConsistencyLevel
      • ConstantReconnectionPolicy
      • ConstantSpeculativeExecutionPolicy
      • CqlColumn
      • CustomColumnInfo
      • DataCollectionMetadata
      • DataCollectionMetadata.SortOrder
      • DCAwareRoundRobinPolicy
      • DecimalTypeAdapter
      • DefaultRetryPolicy
      • Diagnostics
      • DowngradingConsistencyRetryPolicy
      • DriverException
      • DriverInternalError
      • DseCluster
      • DseClusterBuilder
      • DseConfiguration
      • DseLoadBalancingPolicy
      • Duration
      • DynamicCompositeTypeAdapter
      • EC2MultiRegionTranslator
      • ExecutionException
      • ExecutionInfo
      • ExponentialReconnectionPolicy
      • Extensions
      • FallthroughRetryPolicy
      • FixedReconnectionPolicy
      • FunctionFailureException
      • FunctionMetadata
      • Host
      • HostDistance
      • HostsEventArgs
      • HostsEventArgs.Kind
      • HostsEventHandler
      • IAddressTranslator
      • IAuthenticator
      • IAuthProvider
      • IAuthProviderNamed
      • ICluster
      • IColumnInfo
      • IdempotenceAwareRetryPolicy
      • IDseCluster
      • IDseSession
      • IExecutionProfile
      • IExecutionProfileBuilder
      • IExecutionProfileOptions
      • IExtendedRetryPolicy
      • IFrameCompressor
      • IInitializer
      • ILoadBalancingPolicy
      • IndexMetadata
      • IndexMetadata.IndexKind
      • InvalidConfigurationInQueryException
      • InvalidQueryException
      • InvalidTypeException
      • IReconnectionPolicy
      • IReconnectionSchedule
      • IRetryPolicy
      • IsBootstrappingException
      • ISession
      • ISessionState
      • ISpeculativeExecutionPlan
      • ISpeculativeExecutionPolicy
      • IStatement
      • ITimestampGenerator
      • ITypeAdapter
      • KeyspaceMetadata
      • KeyType
      • ListColumnInfo
      • LocalDate
      • LocalTime
      • Logger
      • LoggingRetryPolicy
      • MapColumnInfo
      • MaterializedViewMetadata
      • Metadata
      • MetadataSyncOptions
      • MetricsExtensions
      • MonitorReportingOptions
      • NoHostAvailableException
      • NoneAuthProvider
      • NoSpeculativeExecutionPolicy
      • NullTypeAdapter
      • OperationTimedOutException
      • OverloadedException
      • PlainTextAuthProvider
      • Policies
      • PoolingOptions
      • 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
      • SchemaChangedEventArgs
      • SchemaChangedEventArgs.Kind
      • SchemaChangedEventHandler
      • ServerErrorException
      • Session
      • SetColumnInfo
      • SimpleStatement
      • SocketOptions
      • SSLOptions
      • Statement
      • SyntaxError
      • TableColumn
      • TableMetadata
      • TableOptions
      • TimeUuid
      • TokenAwarePolicy
      • ToManyConnectionsPerHost
      • TraceRetrievalException
      • TruncateException
      • TupleColumnInfo
      • TypeAdapters
      • UdtColumnInfo
      • UdtMap
      • UdtMap<T>
      • UdtMappingDefinitions
      • UnauthorizedException
      • UnavailableException
      • Unset
      • WriteFailureException
      • WriteTimeoutException
    • Dse.AppMetrics
      • DriverAppMetricsOptions
    • Dse.AppMetrics.MetricTypes
      • IAppMetricsCounter
      • IAppMetricsGauge
      • IAppMetricsMeter
      • IAppMetricsMetric
      • IAppMetricsTimer
    • Dse.AppMetrics.MetricValues
      • IAppMetricsHistogramValue
      • IAppMetricsMeterValue
      • IAppMetricsMetricWithValue<T>
      • IAppMetricsTimerValue
    • Dse.Auth
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
    • Dse.Auth.Sspi
      • SspiException
    • Dse.Data
      • CqlBatchTransaction
      • CqlCommand
      • CqlConnection
      • CqlDataAdapter
      • CqlParameter
      • CqlParameterCollection
      • CqlProviderFactory
      • CqlReader
    • Dse.Data.Linq
      • AllowFilteringAttribute
      • Batch
      • ClusteringKeyAttribute
      • ColumnAttribute
      • CompactStorageAttribute
      • CounterAttribute
      • CqlArgumentException
      • CqlCommand
      • CqlConditionalCommand<TEntity>
      • CqlDelete
      • CqlFunction
      • CqlInsert<TEntity>
      • CqlLinqNotSupportedException
      • CqlOperator
      • CqlQuery<TEntity>
      • CqlQueryBase<TEntity>
      • CqlQueryExtensions
      • CqlQuerySingleElement<TEntity>
      • CqlScalar<TEntity>
      • CqlToken
      • CqlUpdate
      • IgnoreAttribute
      • ITable
      • PartitionKeyAttribute
      • SecondaryIndexAttribute
      • SessionExtensions
      • StaticColumnAttribute
      • Table<TEntity>
      • TableAttribute
      • TableType
    • Dse.Geometry
      • GeometryBase
      • LineString
      • Point
      • Polygon
    • Dse.Graph
      • Edge
      • Element
      • GraphNode
      • GraphOptions
      • GraphResultSet
      • GraphStatement
      • IEdge
      • IElement
      • IGraphNode
      • IGraphStatement
      • IPath
      • IProperty
      • IVertex
      • IVertexProperty
      • Path
      • SimpleGraphStatement
      • Vertex
    • Dse.Mapping
      • AppliedInfo<T>
      • ColumnMap
      • Cql
      • CqlQueryOptions
      • IColumnDefinition
      • ICqlBatch
      • ICqlQueryAsyncClient
      • ICqlQueryClient
      • ICqlWriteAsyncClient
      • ICqlWriteClient
      • IMapper
      • IPage<T>
      • ITypeDefinition
      • Map<TPoco>
      • Mapper
      • MappingConfiguration
      • Mappings
      • SortOrder
    • Dse.Mapping.Attributes
      • ClusteringKeyAttribute
      • ColumnAttribute
      • CounterAttribute
      • FrozenAttribute
      • FrozenKeyAttribute
      • FrozenValueAttribute
      • IgnoreAttribute
      • PartitionKeyAttribute
      • SecondaryIndexAttribute
      • StaticColumnAttribute
      • TableAttribute
    • Dse.Mapping.TypeConversion
      • DefaultTypeConverter
      • EnumStringMapper<T>
      • NullableEnumStringMapper<T>
      • TypeConverter
    • Dse.Mapping.Utils
      • MemberInfoExtensions
    • Dse.Metrics
      • DriverMetricsOptions
      • IDriverMetrics
      • IMetric
      • IMetricsRegistry<TMetric>
      • NodeMetric
      • NodeMetric.Counters
      • NodeMetric.Gauges
      • NodeMetric.Meters
      • NodeMetric.Timers
      • SessionMetric
      • SessionMetric.Counters
      • SessionMetric.Gauges
      • SessionMetric.Meters
      • SessionMetric.Timers
    • Dse.Metrics.Abstractions
      • IDriverCounter
      • IDriverGauge
      • IDriverMeter
      • IDriverMetric
      • IDriverMetricsProvider
      • IDriverTimer
    • Dse.Search
      • DateRange
      • DateRangeBound
      • DateRangePrecision
    • Dse.Serialization
      • CustomTypeSerializer<T>
      • TypeSerializer
      • TypeSerializer<T>
      • TypeSerializerDefinitions
      • UdtSerializer

    Class SimpleStatement

    A simple IStatement implementation built directly from a query string.

    Inheritance
    System.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(Boolean)
    Statement.SetPagingState(Byte[])
    Statement.SetReadTimeoutMillis(Int32)
    Statement.SetConsistencyLevel(Nullable<ConsistencyLevel>)
    Statement.SetSerialConsistencyLevel(ConsistencyLevel)
    Statement.SetTimestamp(DateTimeOffset)
    Statement.EnableTracing(Boolean)
    Statement.DisableTracing()
    Statement.SetRetryPolicy(IRetryPolicy)
    Statement.SetIdempotence(Boolean)
    Statement.SetPageSize(Int32)
    Statement.SetOutgoingPayload(IDictionary<String, Byte[]>)
    Statement.SetHost(Host)
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Dse
    Assembly: Dse.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
    System.Collections.Generic.IDictionary<System.String, System.Object> valuesDictionary

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

    System.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, Object[])

    SimpleStatement(String)

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

    Declaration
    public SimpleStatement(string query)
    Parameters
    Type Name Description
    System.String query

    The cql query string.

    SimpleStatement(String, 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
    System.String query

    The cql query string.

    System.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
    System.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
    System.String
    Overrides
    RegularStatement.QueryString

    RoutingKey

    Gets the routing key for the query.

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

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

    Methods

    Bind(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
    System.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
    System.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
    System.String name

    The keyspace name.

    Returns
    Type Description
    SimpleStatement

    SetQueryString(String)

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

    SetRoutingKey(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(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
    System.Object[] keys
    Returns
    Type Description
    SimpleStatement

    Implements

    IStatement
    Back to top © DataStax, All rights reserved.