Пример #1
0
        internal override IQueryRequest CreateBatchRequest(int protocolVersion)
        {
            //Uses the default query options as the individual options of the query will be ignored
            var options = QueryProtocolOptions.CreateFromQuery(this, new QueryOptions());

            return(new ExecuteRequest(protocolVersion, PreparedStatement.Id, PreparedStatement.Metadata, IsTracing, options));
        }
Пример #2
0
        /// <summary>
        /// Gets the Request to send to a cassandra node based on the statement type
        /// </summary>
        internal IRequest GetRequest(IStatement statement)
        {
            var defaultConsistency = Configuration.QueryOptions.GetConsistencyLevel();

            if (statement is RegularStatement)
            {
                var s       = (RegularStatement)statement;
                var options = QueryProtocolOptions.CreateFromQuery(s, defaultConsistency);
                options.ValueNames = s.QueryValueNames;
                return(new QueryRequest(BinaryProtocolVersion, s.QueryString, s.IsTracing, options));
            }
            if (statement is BoundStatement)
            {
                var s       = (BoundStatement)statement;
                var options = QueryProtocolOptions.CreateFromQuery(s, defaultConsistency);
                return(new ExecuteRequest(BinaryProtocolVersion, s.PreparedStatement.Id, null, s.IsTracing, options));
            }
            if (statement is BatchStatement)
            {
                var s           = (BatchStatement)statement;
                var consistency = defaultConsistency;
                if (s.ConsistencyLevel != null)
                {
                    consistency = s.ConsistencyLevel.Value;
                }
                return(new BatchRequest(BinaryProtocolVersion, s, consistency));
            }
            throw new NotSupportedException("Statement of type " + statement.GetType().FullName + " not supported");
        }
Пример #3
0
        internal override IQueryRequest CreateBatchRequest(int protocolVersion)
        {
            //The consistency of each query will be not used.
            var options = QueryProtocolOptions.CreateFromQuery(this, Cassandra.ConsistencyLevel.Any);

            return(new ExecuteRequest(protocolVersion, PreparedStatement.Id, PreparedStatement.Metadata, IsTracing, options));
        }
        internal override IQueryRequest CreateBatchRequest(int protocolVersion)
        {
            //Uses the default query options as the individual options of the query will be ignored
            var options = QueryProtocolOptions.CreateFromQuery(this, new QueryOptions());

            return(new QueryRequest(protocolVersion, QueryString, IsTracing, options));
        }
Пример #5
0
        internal IAsyncResult BeginQuery(RegularStatement query, AsyncCallback callback, object state, object tag = null)
        {
            var options      = QueryProtocolOptions.CreateFromQuery(query, Cluster.Configuration.QueryOptions.GetConsistencyLevel());
            var longActionAc = new AsyncResult <RowSet>(-1, callback, state, this, "SessionQuery", query, tag);
            var handler      = new QueryRequestHandler()
            {
                Consistency          = options.Consistency,
                CqlQuery             = query.QueryString,
                Statement            = query,
                QueryProtocolOptions = options,
                LongActionAc         = longActionAc,
                IsTracing            = query.IsTracing
            };

            ExecConn(handler, false);

            return(longActionAc);
        }
Пример #6
0
        internal IAsyncResult BeginExecuteQuery(BoundStatement statement, AsyncCallback callback, object state, object tag = null)
        {
            var options = QueryProtocolOptions.CreateFromQuery(statement, Cluster.Configuration.QueryOptions.GetConsistencyLevel());
            var queryId = statement.PreparedStatement.Id;

            var longActionAc = new AsyncResult <RowSet>(-1, callback, state, this, "SessionExecuteQuery", statement, tag);
            var handler      = new ExecuteQueryRequestHandler()
            {
                Consistency          = options.Consistency,
                Id                   = queryId,
                CqlQuery             = GetPreparedQuery(queryId),
                Metadata             = statement.PreparedStatement.Metadata,
                QueryProtocolOptions = options,
                Statement            = statement,
                LongActionAc         = longActionAc,
                IsTracing            = statement.IsTracing
            };

            ExecConn(handler, false);
            return(longActionAc);
        }
Пример #7
0
 internal override IQueryRequest CreateBatchRequest()
 {
     return(new QueryRequest(-1, QueryString, IsTracing, QueryProtocolOptions.CreateFromQuery(this, Cassandra.ConsistencyLevel.Any)));
     // this Cassandra.ConsistencyLevel.Any is not used due fact that BATCH got own CL
 }
Пример #8
0
 internal override IQueryRequest CreateBatchRequest()
 {
     return(new ExecuteRequest(-1, PreparedStatement.Id, PreparedStatement.Metadata, IsTracing,
                               QueryProtocolOptions.CreateFromQuery(this, Cassandra.ConsistencyLevel.Any)));
     // this Cassandra.ConsistencyLevel.Any is not used due fact that BATCH got own CL
 }