Package com.datastax.driver.core

Examples of com.datastax.driver.core.Query


  public ResponseData get(Object rkey, Object colName) throws OperationException {
    Session session = DataStaxClientConnection.instance.session();
    TableMetadata tm = DataStaxClientConnection.instance.getKeyspaceMetadata().getTable(cfName);
    String partitionKey = tm.getPartitionKey().get(0).getName();
   
    Query query = QueryBuilder.select(colName.toString()).from(cfName).where(QueryBuilder.eq(partitionKey, rkey)).limit(1000000)
        .setConsistencyLevel(ConsistencyLevel.valueOf(com.netflix.jmeter.properties.Properties.instance.cassandra.getReadConsistency()));
   
    ResultSetFuture rs = session.executeAsync(query);

    int size = 0;
View Full Code Here


            if (list != null)
                list.beforeFetchingNextBatch();
            try {
                Clause inClause = QueryBuilder.in("id", keyStrings);
                //change the batchsize
                Query query = QueryBuilder.select().all().from(keys, cf.getColumnFamily()).where(inClause).limit(100);
                resultSet = session.execute(query);
            } catch (Exception e) {
                System.out.println(" Exception:" + e.getMessage());
            }
            if (list != null) list.afterFetchingNextBatch(batchSize);
View Full Code Here

            if (list != null)
                list.beforeFetchingNextBatch();
            try {
                // CHANGE THE BATCHSIZE
                Clause inClause = QueryBuilder.in("id", keyStrings);
                Query query = QueryBuilder.select().all().from(keys, cf.getColumnFamily()).where(inClause).limit(100);
                resultSet = session.execute(query);
            } catch (Exception e) {
                System.out.println(" Exception:" + e.getMessage());
            }
            if (list != null) list.afterFetchingNextBatch(batchSize);
View Full Code Here

                batchListener.beforeFetchingNextBatch();

            String rowKeyString = StandardConverters.convertFromBytes(String.class, rowKey);
            Select selectQuery = QueryBuilder.select().all().from(keySpace, indTable).allowFiltering();
            Where whereClause = Cql3Util.createRowQuery(from, to, columnMeta, selectQuery, rowKeyString, indTable);
            Query query = null;

            if (batchSize != null)
                query = whereClause.limit(batchSize);
            else
                query = whereClause.disableTracing();
View Full Code Here

            batchListener.beforeFetchingNextBatch();

        columnNameType = sliceInfo.getColumnNameType();
        ResultSet resultSet = null;
        Clause rkClause = QueryBuilder.eq("id", ByteBuffer.wrap(rowKey));
        Query query = null;
        query = QueryBuilder.select().all().from(keys, table).where(rkClause).disableTracing();

        subList = new ArrayList<com.datastax.driver.core.Row>();
        try {
            resultSet = session.execute(query);
View Full Code Here

            value = Cql3Util.checkForBooleanAndNull(value, indTable, columnMeta);

            Clause valClause = QueryBuilder.eq("colname", value);
            selectWhere.and(valClause);

            Query query = selectWhere.disableTracing();

            Future future = session.executeAsync(query);
            futures.add(future);
        }
View Full Code Here

    private void checkIfRowExsits(String table, byte[] rowKey, String colName) {
        Clause rkClause = QueryBuilder.eq("id", ByteBuffer.wrap(rowKey));
        Clause cnClause = QueryBuilder.eq("colname", colName);
        try {
            Query query = QueryBuilder.select().all().from(keys, table).where(rkClause).and(cnClause);
            ResultSet resultSet = session.execute(query);
            if (resultSet.isExhausted())
                return;
            else {
                Query delQuery = QueryBuilder.delete().from(keys, table).where(rkClause).and(cnClause);
                session.execute(delQuery);
            }
        } catch (Exception e) {
            System.out.println(" Exception:" + e.getMessage());
        }
View Full Code Here

        if (action.getAction() == null)
            throw new IllegalArgumentException("action param is missing ActionEnum so we know to remove entire row or just columns in the row");
        switch (action.getAction()) {
        case REMOVE_ENTIRE_ROW:
            Clause eqClause = QueryBuilder.eq("id", ByteBuffer.wrap(action.getRowKey()));
            Query query = QueryBuilder.delete().from(keys, table).where(eqClause);
            session.execute(query);
            break;
        case REMOVE_COLUMNS_FROM_ROW:
            removeColumns(action, table);
            break;
View Full Code Here

    }

    private void removeColumnImpl(byte[] rowKey, String table, String colName) {
        Clause eqClause = QueryBuilder.eq("id",ByteBuffer.wrap(rowKey));
        Clause eqColClause = QueryBuilder.eq("colname", colName);
        Query query = QueryBuilder.delete().from(keys, table).where(eqClause).and(eqColClause);
        session.execute(query);
    }
View Full Code Here

                } else {
                    indClause = QueryBuilder.eq("colname", "");
                }
            }
            Clause fkClause = QueryBuilder.eq("colvalue", ByteBuffer.wrap(fk));
            Query query = QueryBuilder.delete().from(keys, table).where(eqClause).and(indClause).and(fkClause);
            session.execute(query);
        }
    }
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.Query

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.