Refine search
/** * @return cql query statement to delete a workflow from the "workflows" table */ public String getDeleteWorkflowStatement() { return QueryBuilder.delete() .from(keyspace, TABLE_WORKFLOWS) .where(eq(WORKFLOW_ID_KEY, bindMarker())) .and(eq(SHARD_ID_KEY, bindMarker())) .getQueryString(); }
@Override public void deleteMessageData( final UUID messageId ) { logger.trace("deleteMessageData {}", messageId); Clause messageIdClause = QueryBuilder.eq(COLUMN_MESSAGE_ID, messageId); Statement delete = QueryBuilder.delete().from(TABLE_MESSAGE_DATA).where(messageIdClause); cassandraClient.getApplicationSession().execute(delete); }
@Override public void removeByEndpointKeyHashAndConfigurationVersion(byte[] endpointKeyHash, Integer confSchemaVersion) { LOG.debug("Remove endpoint specific configuration by endpointKeyHash {} and confSchemaVersion {}", endpointKeyHash, confSchemaVersion); Delete.Where deleteQuery = delete().from(getColumnFamilyName()) .where(eq(EPS_CONFIGURATION_KEY_HASH_PROPERTY, getByteBuffer(endpointKeyHash))) .and(eq(EP_CONFIGURATION_VERSION_PROPERTY, confSchemaVersion)); LOG.trace("Remove endpoint specific configuration by endpointKeyHash and confSchemaVersion query {}", deleteQuery); execute(deleteQuery); }
private ImmutableList<BuiltStatement> nonIdempotentBuiltStatements() { return ImmutableList.of( update("foo").with(append("l", 1)).where(eq("k", 1)), // append to list update("foo").with(set("v", 1)).and(prepend("l", 1)).where(eq("k", 1)), // prepend to list update("foo").with(incr("c")).where(eq("k", 1)), // counter update update("foo").with(set("v", Lists.newArrayList(now()))).where(eq("k", 1)), update("foo").with(set("v", Lists.newArrayList(uuid()))).where(eq("k", 1)), delete().from("foo").where(lt("k", fcall("now"))), delete().from("foo").where(lt("k", now())), update("foo").where(eq("k", fcall("now"))), delete().listElt("a", 1).from("test_coll"), update("foo").with(set("v", 0)).onlyIf(contains("hello", "world")), insertInto("foo").value("k", 1).value("v", Sets.newHashSet(now())).ifNotExists(), delete().from("foo").where(eq("k", 2)).ifExists(), delete().from("foo").onlyIf(eq("k", 2)),
query += "APPLY BATCH;"; batch = batch() .add( insertInto("foo") .values( new String[] {"a", "b"}, })) .add( update("foo") .with(setIdx("a", 2, "foo")) .and(prependAll("b", Arrays.asList(3, 2, 1))) .add( delete() .listElt("a", 3) .mapElt("b", "foo") .column("c") .from("foo") .where(eq("k", 1))) .using(timestamp(42)); assertEquals(batch.toString(), query); query += "DELETE a[3] FROM foo WHERE k=1;"; query += "APPLY BATCH;"; batch = batch(delete().listElt("a", 3).from("foo").where(eq("k", 1))); assertEquals(batch.toString(), query);
delete = delete().listElt("a", 3).mapElt("b", "foo").column("c").from("foo").where(eq("k", 1)); assertEquals(delete.toString(), query); .listElt("a", bindMarker()) .mapElt("b", bindMarker()) .column("c") .from("foo") .where(eq("k", 1)); assertEquals(delete.toString(), query); delete = delete().all().from("foo").using(timestamp(1240003134L)).where(eq("k", "value")); assertEquals(delete.toString(), query); delete = delete().from("foo").using(timestamp(1240003134L)).where(eq("k", "value")); assertEquals(delete.toString(), query); delete = delete().from("foo", "bar").where(eq("k1", "foo")).and(eq("k2", 1)); assertEquals(delete.toString(), query); delete().column("a").all().from("foo"); fail("Expected an IllegalStateException"); } catch (IllegalStateException e) { delete().from("foo").using(timestamp(-1240003134L)); fail("Expected an IllegalArgumentException"); } catch (IllegalArgumentException e) { delete = delete().from("foo", "bar").where(eq("k1", "foo")).ifExists(); assertEquals(delete.toString(), query);
@Override public void removeNotificationsByAppId(String appId) { LOG.debug("Remove endpoint notifications by app id {}", appId); Statement deleteEpNfs = delete().from(getColumnFamilyName()) .where( QueryBuilder.in( ET_NF_ENDPOINT_KEY_HASH_PROPERTY, cassandraEpByAppIdDao.getEpIdsListByAppId(appId))); LOG.trace("Execute query {}", deleteEpNfs); execute(deleteEpNfs); }
/** * Starts building a new {@code DELETE} query. * * @return an in-construction {@code DELETE} query (you will need to provide a column selection * and at least a {@code FROM} and a {@code WHERE} clause to complete the query). */ public static Delete.Selection delete() { return new Delete.Selection(); }
/** * Generate DELETE <strong>name</strong> ... */ public final EntityWithCustomConstructor_Delete.Cols name() { delete.column("name"); return new EntityWithCustomConstructor_Delete.Cols(delete); }
/** * Generate DELETE <strong>optionaludt</strong> ... */ public final EntityWithNestedUDT_Delete.Cols optionalUDT() { delete.column("optionaludt"); return new EntityWithNestedUDT_Delete.Cols(delete); }
/** * Generate DELETE <strong>complexudt</strong> ... */ public final EntityWithNestedUDT_Delete.Cols complexUDT() { delete.column("complexudt"); return this; }
/** * Generate DELETE <strong>listudt</strong> ... */ public final EntityWithUDTs_Delete.Cols listUDT() { delete.column("listudt"); return new EntityWithUDTs_Delete.Cols(delete); }
/** * Generate DELETE <strong>tuple</strong> ... */ public final EntityWithComplexTuple_Delete.Cols tuple() { delete.column("tuple"); return this; }
/** * Generate DELETE <strong>count</strong> ... */ public final EntityWithComplexCounters_Delete.Cols simpleCounter() { delete.column("count"); return new EntityWithComplexCounters_Delete.Cols(delete); }
/** * Generate DELETE <strong>value</strong> ... */ public final EntityWithMissingPartitionKey_Delete.Cols value() { delete.column("value"); return this; }
/** * Generate DELETE <strong>value</strong> ... */ public final EntityWithNonExistingKeyspace_Delete.Cols value() { delete.column("value"); return new EntityWithNonExistingKeyspace_Delete.Cols(delete); }
/** * Generate DELETE <strong>value</strong> ... */ public final EntityWithMissingStaticCol_Delete.Cols value() { delete.column("value"); return new EntityWithMissingStaticCol_Delete.Cols(delete); }
/** * Generate DELETE <strong>udt</strong> ... */ public final EntityWithCustomConstructorAndDeclaredFields_Delete.Cols udt() { delete.column("udt"); return new EntityWithCustomConstructorAndDeclaredFields_Delete.Cols(delete); }
/** * Generate DELETE <strong>udt</strong> ... */ public final EntityWithCustomConstructorAndDeclaredFields_Delete.Cols udt() { delete.column("udt"); return this; }