Package com.datastax.driver.core.querybuilder

Examples of com.datastax.driver.core.querybuilder.Delete


                        where.and(eq(mapper.getPrimaryKeyColumn(i).getColumnName(), bindMarker()));
                    return select.toString();
                }
            case DEL:
                {
                    Delete delete = table == null
                                  ? delete().all().from(mapper.getKeyspace(), mapper.getTable())
                                  : delete().all().from(table);
                    Delete.Where where = delete.where();
                    for (int i = 0; i < mapper.primaryKeySize(); i++)
                        where.and(eq(mapper.getPrimaryKeyColumn(i).getColumnName(), bindMarker()));
                    return delete.toString();
                }
            case SLICE:
            case REVERSED_SLICE:
                {
                    Select select = table == null
View Full Code Here


      CassandraTableName tableName,
      EntityId entityId,
      CassandraColumnName column,
      Long version
  ) {
    final Delete delete = delete()
        .all()
        .from(tableName.getKeyspace(), tableName.getTable());

    for (Map.Entry<String, Object> component
        : getEntityIdColumnValues(layout, entityId).entrySet()) {
      delete.where(eq(component.getKey(), component.getValue()));
    }

    if (column != null) {
      delete.where(eq(FAMILY_COL, column.getFamilyBuffer()));
      if (column.containsQualifier()) {
        delete.where(eq(QUALIFIER_COL, column.getQualifierBuffer()));
        if (version != null) {
          delete.where(eq(VERSION_COL, version));
        }
      }
    }

    return delete;
View Full Code Here

        super(keySpace);
    }

    public <K> void deleteByKeyAsync(K key, Class<?> bean, Session session,
            ConsistencyLevel consistency) {
        Delete delete = runDelete(key, bean, consistency);
        session.executeAsync(delete);
    }
View Full Code Here

        return true;
    }

    public <K> boolean deleteByKey(K key, Class<?> bean, Session session,
            ConsistencyLevel consistency) {
        Delete delete = runDelete(key, bean, consistency);
        session.execute(delete);
        return true;
    }
View Full Code Here

            throw new KeyProblemsException(
                    "The parameter key to column family should be passed");
        }
        ClassInformation classInformations = ClassInformations.INSTACE.getClass(bean);
        KeySpaceInformation keyInformation = classInformations.getKeySpace(keySpace);
        Delete delete = QueryBuilder
                .delete()
                .all()
                .from(keyInformation.getKeySpace(),
                        keyInformation.getColumnFamily());

        FieldInformation keyField = classInformations.getKeyInformation();
        if (classInformations.isComplexKey()) {
            runComplexKey(delete, key, keyField.getSubFields().getFields());
        } else {
            delete.where(QueryBuilder.eq(keyField.getName(), key));
        }

        delete.setConsistencyLevel(consistency);
        return delete;
    }
View Full Code Here

        if (resultSet.isExhausted()) {
            // not found
            return;
        }

        Delete deleteStatement = delete().from(tableName);
        deleteStatement
                .where(eq(partitionKeyColumnName, rowKey))
                .and(eq(pathColumnName, bindMarker()));

        batch = batchContext == null ? batch() : batch;
        List<Object> bindArguments = batchContext == null ?
View Full Code Here

                        where.and(eq(mapper.getPrimaryKeyColumn(i).getColumnName(), bindMarker()));
                    return select.toString();
                }
            case DEL:
                {
                    Delete delete = table == null
                                  ? delete().all().from(mapper.getKeyspace(), mapper.getTable())
                                  : delete().all().from(table);
                    Delete.Where where = delete.where();
                    for (int i = 0; i < mapper.primaryKeySize(); i++)
                        where.and(eq(mapper.getPrimaryKeyColumn(i).getColumnName(), bindMarker()));
                    return delete.toString();
                }
            case SLICE:
            case REVERSED_SLICE:
                {
                    Select select = table == null
View Full Code Here

        if (resultSet.isExhausted()) {
            // not found
            return;
        }

        Delete deleteStatement = delete().from(tableName);
        deleteStatement
                .using(timestamp(getCurrentMicros()))
                .where(eq(partitionKeyColumnName, rowKey))
                .and(eq(pathColumnName, bindMarker()));

        batch = batchContext == null ? batch() : batch;
View Full Code Here

    Assert.notNull(type);
    Assert.notNull(id);

    CassandraPersistentEntity<?> entity = mappingContext.getPersistentEntity(type);

    Delete delete = QueryBuilder.delete().from(entity.getTableName().toCql());
    appendIdCriteria(delete.where(), entity, id);

    execute(delete);
  }
View Full Code Here

  }

  protected <T> void doDelete(T entity, QueryOptions options) {

    Assert.notNull(entity);
    Delete delete = createDeleteQuery(getTableName(entity.getClass()).toCql(), entity, options, cassandraConverter);
    execute(delete);
  }
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.querybuilder.Delete

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.