Java Code Examples for org.apache.cassandra.cql3.QueryOptions#fromProtocolV1()

The following examples show how to use org.apache.cassandra.cql3.QueryOptions#fromProtocolV1() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueryMessage.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public QueryMessage decode(ByteBuf body, int version)
{
    String query = CBUtil.readLongString(body);
    if (version == 1)
    {
        ConsistencyLevel consistency = CBUtil.readConsistencyLevel(body);
        return new QueryMessage(query, QueryOptions.fromProtocolV1(consistency, Collections.<ByteBuffer>emptyList()));
    }
    else
    {
        return new QueryMessage(query, QueryOptions.codec.decode(body, version));
    }
}
 
Example 2
Source File: ExecuteMessage.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public ExecuteMessage decode(ByteBuf body, int version)
{
    byte[] id = CBUtil.readBytes(body);
    if (version == 1)
    {
        List<ByteBuffer> values = CBUtil.readValueList(body);
        ConsistencyLevel consistency = CBUtil.readConsistencyLevel(body);
        return new ExecuteMessage(MD5Digest.wrap(id), QueryOptions.fromProtocolV1(consistency, values));
    }
    else
    {
        return new ExecuteMessage(MD5Digest.wrap(id), QueryOptions.codec.decode(body, version));
    }
}