Package com.datastax.driver.core

Examples of com.datastax.driver.core.Statement


        whereCQL);
    return CQLStatement.make(query, makeTableName(def,index), values.toArray());
  }

  public static Statement makeCQLforDeleteUUIDFromIndex_WorkaroundForUnpreparableTimestamp(String keyspace, CDefinition def, CIndex index, UUID uuid, Map<String,Object> indexValues, Long timestamp){
    Statement ret = QueryBuilder.delete()
        .from(keyspace,makeIndexTableName(def,index))
        .using(QueryBuilder.timestamp(timestamp))
        .where(QueryBuilder.eq("id",uuid))
        .and(QueryBuilder.eq("shardid", Long.valueOf(index.getShardingStrategy().getShardKey(uuid))));
    for(String key : indexValues.keySet()){
View Full Code Here


            // 65535 is max number of stmts per batch, so if we have more, we need to manually batch them
            for (int j = 0 ; j < stmts.size() ; j += 65535)
            {
                List<BoundStatement> substmts = stmts.subList(j, Math.min(j + stmts.size(), j + 65535));
                Statement stmt;
                if (stmts.size() == 1)
                {
                    stmt = substmts.get(0);
                }
                else
View Full Code Here

    final CassandraTableName table =
        CassandraTableName.getLocalityGroupTableName(tableURI, localityGroupId);

    if (column.isFullyQualified()) {

      final Statement statement =
          CQLUtils.getQualifiedColumnGetStatement(
              layout,
              table,
              entityId,
              cassandraColumn,
              dataRequest,
              columnRequest);

      return Futures.transform(
          admin.executeAsync(statement),
          RowDecoders.<T>getQualifiedColumnDecoderFunction(column, decoderProvider));
    } else {

      if (columnRequest.getMaxVersions() != 0) {
        LOG.warn("Cassandra Kiji can not efficiently get a column family with max versions"
                + " (column family: {}, max version: {}). Filtering versions on the client.",
            column, columnRequest.getMaxVersions());
      }

      if (dataRequest.getMaxTimestamp() != Long.MAX_VALUE
          || dataRequest.getMinTimestamp() != Long.MIN_VALUE) {
        LOG.warn("Cassandra Kiji can not efficiently restrict a timestamp on a column family: "
                + " (column family: {}, data request: {}). Filtering timestamps on the client.",
            column, dataRequest);
      }

      final Statement statement =
          CQLUtils.getColumnFamilyGetStatement(
              layout,
              table,
              entityId,
              cassandraColumn,
View Full Code Here

      final ByteBuffer valueBuffer =
          ByteBuffer.wrap(
              mCapsule.getCellEncoderProvider().getEncoder(family, qualifier).encode(value));

      final Statement put = CQLUtils.getInsertStatement(
          mCapsule.getLayout(),
          table,
          entityId,
          cassandraColumn,
          version,
View Full Code Here

      for (LocalityGroupLayout localityGroup : layout.getLocalityGroups()) {
        final ColumnId localityGroupId = localityGroup.getId();
        final CassandraTableName table =
            CassandraTableName.getLocalityGroupTableName(tableURI.getURI(), localityGroupId);

        final Statement delete =
            CQLUtils.getLocalityGroupDeleteStatement(layout, table, entityId);

        mBufferedStatements.put(table, delete);
        mCurrentWriteBufferSize += 1;
      }
View Full Code Here

          mCapsule
              .getColumnNameTranslator()
              .toCassandraColumnName(KijiColumnName.create(family, qualifier));


      final Statement delete =
          CQLUtils.getColumnDeleteStatement(layout, table, entityId, column);
      mBufferedStatements.put(table, delete);

      mCurrentWriteBufferSize += 1;
      if (mCurrentWriteBufferSize > mMaxWriteBufferSize) {
View Full Code Here

      final CassandraTableName table =
          CassandraTableName.getLocalityGroupTableName(
              tableURI,
              familyLayout.getLocalityGroup().getId());

      final Statement delete =
          CQLUtils.getCellDeleteStatement(
              layout,
              table,
              entityId,
              column,
View Full Code Here

      for (final CassandraTableName table : mBufferedStatements.keySet()) {
        final List<Statement> statements = mBufferedStatements.removeAll(table);

        if (statements.size() > 0) {
          final Statement statement;
          if (statements.size() == 1) {
            statement = statements.get(0);
          } else {
            statement = new BatchStatement(Type.UNLOGGED).addAll(statements);
          }
View Full Code Here

      // We don't actually need the writer layout capsule here, but we want the layout update check.
      getCapsule();

      Preconditions.checkState(mStatements.size() > 0, "No transactions to commit.");

      final Statement statement;
      if (mStatements.size() > 1) {
        statement = new BatchStatement(BatchStatement.Type.UNLOGGED).addAll(mStatements);
      } else {
        statement = mStatements.get(0);
      }
View Full Code Here

      final ByteBuffer valueBuffer =
          ByteBuffer.wrap(
              mCapsule.getCellEncoderProvider().getEncoder(family, qualifier).encode(value));

      final Statement put = CQLUtils.getInsertStatement(
          mCapsule.getLayout(),
          mTableName,
          mEntityId,
          cassandraColumn,
          version,
View Full Code Here

TOP

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

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.