Package org.apache.cassandra.cql3

Examples of org.apache.cassandra.cql3.QueryOptions


        return execute(query, Collections.<ByteBuffer>emptyList(), consistency);
    }

    public ResultMessage execute(String query, List<ByteBuffer> values, ConsistencyLevel consistencyLevel)
    {
        Message.Response msg = execute(new QueryMessage(query, new QueryOptions(consistencyLevel, values)));
        assert msg instanceof ResultMessage;
        return (ResultMessage)msg;
    }
View Full Code Here


        return (ResultMessage.Prepared)msg;
    }

    public ResultMessage executePrepared(byte[] statementId, List<ByteBuffer> values, ConsistencyLevel consistency)
    {
        Message.Response msg = execute(new ExecuteMessage(MD5Digest.wrap(statementId), new QueryOptions(consistency, values)));
        assert msg instanceof ResultMessage;
        return (ResultMessage)msg;
    }
View Full Code Here

        UntypedResultSet result;
        try
        {
            ResultMessage.Rows rows = authorizeStatement.execute(QueryState.forInternalCalls(),
                                                                 new QueryOptions(ConsistencyLevel.LOCAL_ONE,
                                                                                  Lists.newArrayList(ByteBufferUtil.bytes(user.getName()),
                                                                                                     ByteBufferUtil.bytes(resource.getName()))));
            result = new UntypedResultSet(rows.result);
        }
        catch (RequestValidationException e)
View Full Code Here

        UntypedResultSet result;
        try
        {
            ResultMessage.Rows rows = authenticateStatement.execute(QueryState.forInternalCalls(),
                                                                    new QueryOptions(consistencyForUser(username),
                                                                                     Lists.newArrayList(ByteBufferUtil.bytes(username))));
            result = new UntypedResultSet(rows.result);
        }
        catch (RequestValidationException e)
        {
View Full Code Here

    private static UntypedResultSet selectUser(String username)
    {
        try
        {
            ResultMessage.Rows rows = selectUserStatement.execute(QueryState.forInternalCalls(),
                                                                  new QueryOptions(consistencyForUser(username),
                                                                                   Lists.newArrayList(ByteBufferUtil.bytes(username))));
            return new UntypedResultSet(rows.result);
        }
        catch (RequestValidationException e)
        {
View Full Code Here

                catch (NumberFormatException e)
                {
                    return null;
                }
            }
            return new QueryMessage(query, new QueryOptions(ConsistencyLevel.ONE, Collections.<ByteBuffer>emptyList(), false, pageSize, null, null));
        }
        else if (msgType.equals("PREPARE"))
        {
            String query = line.substring(8);
            return new PrepareMessage(query);
        }
        else if (msgType.equals("EXECUTE"))
        {
            try
            {
                byte[] id = Hex.hexToBytes(iter.next());
                List<ByteBuffer> values = new ArrayList<ByteBuffer>();
                while(iter.hasNext())
                {
                    String next = iter.next();
                    ByteBuffer bb;
                    try
                    {
                        int v = Integer.parseInt(next);
                        bb = Int32Type.instance.decompose(v);
                    }
                    catch (NumberFormatException e)
                    {
                        bb = UTF8Type.instance.decompose(next);
                    }
                    values.add(bb);
                }
                return new ExecuteMessage(MD5Digest.wrap(id), new QueryOptions(ConsistencyLevel.ONE, values));
            }
            catch (Exception e)
            {
                return null;
            }
View Full Code Here

                                                                itemId, org.apache.cassandra.cql3.QueryProcessor.MAX_CACHE_PREPARED, itemId));
            logger.trace("Retrieved prepared statement #{} with {} bind markers", itemId, statement.getBoundsTerms());

            return org.apache.cassandra.cql3.QueryProcessor.processPrepared(statement,
                                                                            cState.getQueryState(),
                                                                            new QueryOptions(ThriftConversion.fromThrift(cLevel), bindVariables)).toThriftResult();
        }
        catch (RequestExecutionException e)
        {
            throw ThriftConversion.rethrow(e);
        }
View Full Code Here

                catch (NumberFormatException e)
                {
                    return null;
                }
            }
            return new QueryMessage(query, new QueryOptions(ConsistencyLevel.ONE, Collections.<ByteBuffer>emptyList(), false, pageSize, null, null));
        }
        else if (msgType.equals("PREPARE"))
        {
            String query = line.substring(8);
            return new PrepareMessage(query);
        }
        else if (msgType.equals("EXECUTE"))
        {
            try
            {
                byte[] id = Hex.hexToBytes(iter.next());
                List<ByteBuffer> values = new ArrayList<ByteBuffer>();
                while(iter.hasNext())
                {
                    String next = iter.next();
                    ByteBuffer bb;
                    try
                    {
                        int v = Integer.parseInt(next);
                        bb = Int32Type.instance.decompose(v);
                    }
                    catch (NumberFormatException e)
                    {
                        bb = UTF8Type.instance.decompose(next);
                    }
                    values.add(bb);
                }
                return new ExecuteMessage(MD5Digest.wrap(id), new QueryOptions(ConsistencyLevel.ONE, values));
            }
            catch (Exception e)
            {
                return null;
            }
View Full Code Here

    public final String query;
    public final QueryOptions options;

    public QueryMessage(String query, ConsistencyLevel consistency)
    {
        this(query, new QueryOptions(consistency, Collections.<ByteBuffer>emptyList()));
    }
View Full Code Here

    public final MD5Digest statementId;
    public final QueryOptions options;

    public ExecuteMessage(byte[] statementId, List<ByteBuffer> values, ConsistencyLevel consistency)
    {
        this(MD5Digest.wrap(statementId), new QueryOptions(consistency, values));
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.cql3.QueryOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.