Package com.datastax.driver.core.querybuilder

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


            }

            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


    return c;
  }

  public static Where createRowQuery(Key from, Key to, DboColumnMeta colMeta, Select selectQuery, String rowKey) {
        Where selectWhere = selectQuery.where();
        Clause rkClause = QueryBuilder.eq("id", rowKey);
        selectWhere.and(rkClause);

        Object valFrom = null, valTo = null;
    if (colMeta != null) {
      if (from != null) {
        valFrom = colMeta.getStorageType().convertFromNoSql(from.getKey());
                valFrom = checkForBoolean(valFrom);
      }
      if (to != null) {
        valTo = colMeta.getStorageType().convertFromNoSql(to.getKey());
                valTo = checkForBoolean(valTo);
      }
    } else
      return selectWhere;

        if (from != null) {
            if (from.isInclusive()) {
                Clause gteClause = QueryBuilder.gte("colname", valFrom);
                selectWhere.and(gteClause);
            } else {
                Clause gtClause = QueryBuilder.gt("colname", valFrom);
                selectWhere.and(gtClause);
            }

        }
        if (to != null) {
            if (to.isInclusive()) {
                Clause lteClause = QueryBuilder.lte("colname", valTo);
                selectWhere.and(lteClause);
            }
            else {
                Clause ltClause = QueryBuilder.lt("colname", valTo);
                selectWhere.and(ltClause);
            }
    }
    return selectWhere;
  }
View Full Code Here

  }

    public static Where createRowQueryFromValues(List<byte[]> values, DboColumnMeta colMeta, Select selectQuery, String rowKey) {
        Where selectWhere = selectQuery.where();

        Clause rkClause = QueryBuilder.eq("id", rowKey);
        selectWhere.and(rkClause);

        Object[] valStrings = new Object[values.size()];
        int count = 0;
        for (byte[] value : values) {
            valStrings[count] = StandardConverters.convertFromBytes(String.class, value);
            count++;
        }
       
        Clause inClause = QueryBuilder.in("colname", valStrings);
        selectWhere.and(inClause);
        return selectWhere;
    }
View Full Code Here

    private 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

  @Override
  protected Clause create(Part part, Iterator<Object> iterator) {

    PersistentPropertyPath<CassandraPersistentProperty> path = context.getPersistentPropertyPath(part.getProperty());
    CassandraPersistentProperty property = path.getLeafProperty();
    Clause criteria = from(part, property,
        null /* TODO where(path.toDotPath(CassandraPersistentProperty.PropertyToFieldNameConverter.INSTANCE))*/,
        iterator);

    return criteria;
  }
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.