Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.CqlResult$CqlResultStandardScheme


                thriftCols.add(col);
            }
            // The key of CqlRow shoudn't be needed in CQL3
            cqlRows.add(new CqlRow(ByteBufferUtil.EMPTY_BYTE_BUFFER, thriftCols));
        }
        CqlResult res = new CqlResult(CqlResultType.ROWS);
        res.setRows(cqlRows).setSchema(schema);
        return res;
    }
View Full Code Here


        else
        {
            rows = getSlice(variables);
        }

        CqlResult result = new CqlResult();
        result.type = CqlResultType.ROWS;

        // count resultset is a single column named "count"
        if (parameters.isCount)
        {
View Full Code Here

     */
    public ResultSet executeQuery(String query) throws SQLException
    {
        try
        {
            CqlResult rSet = connection.execute(query);
            // todo: encapsulate.
            return new CassandraResultSet(rSet, connection.decoder, connection.curKeyspace, connection.curColumnFamily);
        }
        catch (InvalidRequestException e)
        {
View Full Code Here

    {
        if (!UpdatePattern.matcher(query).matches())
            throw new SQLException("Not an update statement.");
        try
        {
            CqlResult rSet = connection.execute(query);
            assert rSet.getType().equals(CqlResultType.VOID);
            // if only we knew how many rows were updated.
            return 0;
        }
        catch (InvalidRequestException e)
        {
View Full Code Here

        {
            TimerContext context = session.latency.time();

            boolean success = false;
            String exceptionMessage = null;
            CqlResult results = null;
            String formattedQuery = null;
            List<String> queryParms = Collections.singletonList(getUnQuotedCqlBlob(startOffset, session.cqlVersion.startsWith("3")));

            for (int t = 0; t < session.getRetryTimes(); t++)
            {
View Full Code Here

            if (success)
                break;

            try
            {
                CqlResult result = null;

                if (session.usePreparedStatements())
                {
                    Integer stmntId = getPreparedStatement(client, cqlQuery);
                    if (session.cqlVersion.startsWith("3"))
View Full Code Here

            if (success)
                break;

            try
            {
                CqlResult result = null;

                if (session.usePreparedStatements())
                {
                    Integer stmntId = getPreparedStatement(client, cqlQuery);
                    if (session.cqlVersion.startsWith("3"))
View Full Code Here

            if (success)
                break;

            try
            {
                CqlResult result = null;

                if (session.usePreparedStatements())
                {
                    Integer stmntId = getPreparedStatement(client, cqlQuery);
                    if (session.cqlVersion.startsWith("3"))
View Full Code Here

        else
        {
            rows = getSlice(variables);
        }

        CqlResult result = new CqlResult();
        result.type = CqlResultType.ROWS;

        // Even for count, we need to process the result as it'll group some column together in sparse column families
        CqlMetadata schema = createSchema();
        List<CqlRow> cqlRows = process(rows, schema, variables);
View Full Code Here

                keyspace.doExecuteOperation(new Operation<V>(OperationType.WRITE) {
                    @Override
                    public V execute(Client cassandra) throws HectorException {
                        Object queryResult = null;
                        try {
                            CqlResult result = cassandra.execute_cql_query(query,
                                    useCompression ? Compression.GZIP : Compression.NONE);
                            if (log.isDebugEnabled()) {
                                log.debug("Found CqlResult: {}", result);
                            }
                            switch (result.getType()) {
                                case VOID:
                                    break;

                                case INT:
                                    queryResult = result.getNum()//TODO this may be not correct as there seems to be no way to obtain affected columns/rows
                                    break;

                                default:
                                    throw new IllegalArgumentException(String.format("query returned result rows. use %s instead", CqlQuery.class));
                            }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.CqlResult$CqlResultStandardScheme

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.