Package com.datastax.driver.core.querybuilder

Examples of com.datastax.driver.core.querybuilder.Clause$SimpleClause


    }

    public boolean findIndexRow(String table, String rowKey, byte[] key, Object indValue) {
        Select selectQuery = QueryBuilder.select().all().from(keys, table).allowFiltering();
        Where selectWhere = selectQuery.where();
        Clause rkClause = QueryBuilder.eq("id", rowKey);
        selectWhere.and(rkClause);
        Clause indClause = null;
        if (indValue != null) {
            indClause = QueryBuilder.eq("colname", indValue);
        } else {
            if (table.equalsIgnoreCase("IntegerIndice")) {
                indClause = QueryBuilder.eq("colname", ByteBuffer.wrap(new byte[0]));
            } else {
                indClause = QueryBuilder.eq("colname", "");
            }
        }
        selectWhere.and(indClause);
        Clause keyClause = QueryBuilder.eq("colvalue", ByteBuffer.wrap(key));
        selectWhere.and(keyClause);
        Query query = selectWhere.limit(1);
        ResultSet resultSet = session.execute(query);
        return !resultSet.isExhausted();
   }
View Full Code Here


    private static void addWhereClause(Where where, List<CassandraColumnHandle> partitionKeyColumns, List<Comparable<?>> filterPrefix)
    {
        for (int i = 0; i < filterPrefix.size(); i++) {
            CassandraColumnHandle column = partitionKeyColumns.get(i);
            Object value = column.getCassandraType().getJavaValue(filterPrefix.get(i));
            Clause clause = QueryBuilder.eq(CassandraCqlUtils.validColumnName(column.getName()), value);
            where.and(clause);
        }
    }
View Full Code Here

    private static void addWhereClause(Where where, List<CassandraColumnHandle> partitionKeyColumns, List<Comparable<?>> filterPrefix)
    {
        for (int i = 0; i < filterPrefix.size(); i++) {
            CassandraColumnHandle column = partitionKeyColumns.get(i);
            Object value = column.getCassandraType().getJavaValue(filterPrefix.get(i));
            Clause clause = QueryBuilder.eq(CassandraCqlUtils.validColumnName(column.getName()), value);
            where.and(clause);
        }
    }
View Full Code Here

    private static void addWhereClause(Where where, List<CassandraColumnHandle> partitionKeyColumns, List<Comparable<?>> filterPrefix)
    {
        for (int i = 0; i < filterPrefix.size(); i++) {
            CassandraColumnHandle column = partitionKeyColumns.get(i);
            Object value = column.getCassandraType().getJavaValue(filterPrefix.get(i));
            Clause clause = QueryBuilder.eq(CassandraCqlUtils.validColumnName(column.getName()), value);
            where.and(clause);
        }
    }
View Full Code Here

        String rowKeyString = StandardConverters.convertFromBytes(String.class, rowKey);

        for (byte[] val : values) {
            Select selectQuery = QueryBuilder.select().all().from(keySpace, indTable).allowFiltering();
            Where selectWhere = selectQuery.where();
            Clause rkClause = QueryBuilder.eq("id", rowKeyString);
            selectWhere.and(rkClause);

            Object value = null;
            value = columnMeta.getStorageType().convertFromNoSql(val);
            value = Cql3Util.checkForBoolean(value);

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

            Query query = selectWhere.disableTracing();

            System.out.println("QUERY of STARTQUERYMANYKEY IS: " + query);
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:
            String rowKey = StandardConverters.convertFromBytes(String.class, action.getRowKey());
            Clause eqClause = QueryBuilder.eq("id", rowKey);
            Query query = QueryBuilder.delete().from(keys, table).where(eqClause);
            session.execute(query);
            break;
        case REMOVE_COLUMNS_FROM_ROW:
            removeColumns(action, table);
View Full Code Here

            removeColumnImpl(rowKey, table, colName);
        }
    }

    private void removeColumnImpl(String rowKey, String table, String colName) {
        Clause eqClause = QueryBuilder.eq("id", 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

        boolean exists = findIndexRow(table, rowKey, value);
        if (!exists) {
            if (log.isInfoEnabled())
                log.info("Index: " + column.toString() + " already removed.");
        } else {
            Clause eqClause = QueryBuilder.eq("id", rowKey);
            Clause fkClause = QueryBuilder.eq("colvalue", ByteBuffer.wrap(value));
            Query query = QueryBuilder.delete().from(keys, table).where(eqClause).and(fkClause);
            session.execute(query);
        }
    }
View Full Code Here

    public boolean findIndexRow(String table, String rowKey, byte[] key) {
        Select selectQuery = QueryBuilder.select().all().from(keys, table).allowFiltering();
        //Where whereClause = Cql3Util.createRowQuery(from, to, columnMeta, selectQuery, rowKeyString);
        Where selectWhere = selectQuery.where();
        Clause rkClause = QueryBuilder.eq("id", rowKey);
        selectWhere.and(rkClause);
        Clause keyClause = QueryBuilder.lte("colvalue", ByteBuffer.wrap(key));
        selectWhere.and(keyClause);
        Query query = selectWhere.limit(1);
        //System.out.println("QUERY FOR FINDINDEXROW IS: " + query);
        ResultSet resultSet = session.execute(query);
        return !resultSet.isExhausted();
View Full Code Here

            }

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

TOP

Related Classes of com.datastax.driver.core.querybuilder.Clause$SimpleClause

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.