예제 #1
0
        private QueryFlags GetFlags(ProtocolVersion protocolVersion, bool isPrepared)
        {
            QueryFlags flags = 0;

            if (Values != null && Values.Length > 0)
            {
                flags |= QueryFlags.Values;
            }
            if (SkipMetadata)
            {
                flags |= QueryFlags.SkipMetadata;
            }
            if (PageSize != int.MaxValue && PageSize >= 0)
            {
                flags |= QueryFlags.PageSize;
            }
            if (PagingState != null)
            {
                flags |= QueryFlags.WithPagingState;
            }
            if (SerialConsistency != ConsistencyLevel.Any)
            {
                flags |= QueryFlags.WithSerialConsistency;
            }
            if (protocolVersion.SupportsTimestamp() && RawTimestamp != null)
            {
                flags |= QueryFlags.WithDefaultTimestamp;
            }
            if (protocolVersion.SupportsNamedValuesInQueries() && ValueNames != null && ValueNames.Count > 0)
            {
                flags |= QueryFlags.WithNameForValues;
            }

            if (!isPrepared && protocolVersion.SupportsKeyspaceInRequest() && _keyspace != null)
            {
                // Providing keyspace is only useful for QUERY requests.
                // For EXECUTE requests, the keyspace will be the one from the prepared statement.
                flags |= QueryFlags.WithKeyspace;
            }

            return(flags);
        }