internal static QueryProtocolOptions CreateFromQuery(ProtocolVersion protocolVersion, Statement query,
                                                             QueryOptions queryOptions, Policies policies)
        {
            if (query == null)
            {
                return(Default);
            }
            var  consistency = query.ConsistencyLevel ?? queryOptions.GetConsistencyLevel();
            var  pageSize    = query.PageSize != 0 ? query.PageSize : queryOptions.GetPageSize();
            long?timestamp   = null;

            if (query.Timestamp != null)
            {
                timestamp = TypeSerializer.SinceUnixEpoch(query.Timestamp.Value).Ticks / 10;
            }
            else if (protocolVersion.SupportsTimestamp())
            {
                timestamp = policies.TimestampGenerator.Next();
                if (timestamp == long.MinValue)
                {
                    timestamp = null;
                }
            }
            return(new QueryProtocolOptions(
                       consistency,
                       query.QueryValues,
                       query.SkipMetadata,
                       pageSize,
                       query.PagingState,
                       query.SerialConsistencyLevel,
                       timestamp));
        }
 internal static QueryProtocolOptions CreateFromQuery(Statement query, QueryOptions queryOptions)
 {
     if (query == null)
     {
         return Default;
     }
     var consistency = query.ConsistencyLevel ?? queryOptions.GetConsistencyLevel();
     var pageSize = query.PageSize != 0 ? query.PageSize : queryOptions.GetPageSize();
     var options = new QueryProtocolOptions(
         consistency,
         query.QueryValues,
         query.SkipMetadata, 
         pageSize, 
         query.PagingState, 
         query.SerialConsistencyLevel)
     {
         Timestamp = query.Timestamp
     };
     return options;
 }
示例#3
0
        internal static QueryProtocolOptions CreateFromQuery(Statement query, QueryOptions queryOptions)
        {
            if (query == null)
            {
                return(Default);
            }
            var consistency = query.ConsistencyLevel ?? queryOptions.GetConsistencyLevel();
            var pageSize    = query.PageSize != 0 ? query.PageSize : queryOptions.GetPageSize();
            var options     = new QueryProtocolOptions(
                consistency,
                query.QueryValues,
                query.SkipMetadata,
                pageSize,
                query.PagingState,
                query.SerialConsistencyLevel)
            {
                Timestamp = query.Timestamp
            };

            return(options);
        }