/** * Adds an option to the DELETE statement these conditions are part of. * * @param using the using clause to add. * @return the options of the DELETE statement these conditions are part of. */ public Options using(Using using) { return statement.using(using); } }
/** * Adds an option to the DELETE statement this WHERE clause is part of. * * @param using the using clause to add. * @return the options of the DELETE statement this WHERE clause is part of. */ public Options using(Using using) { return statement.using(using); }
/** * Adds an option to the DELETE statement these conditions are part of. * * @param using the using clause to add. * @return the options of the DELETE statement these conditions are part of. */ public Options using(Using using) { return statement.using(using); } }
/** * Adds an option to the DELETE statement this WHERE clause is part of. * * @param using the using clause to add. * @return the options of the DELETE statement this WHERE clause is part of. */ public Options using(Using using) { return statement.using(using); } }
/** * Adds an option to the DELETE statement this WHERE clause is part of. * * @param using the using clause to add. * @return the options of the DELETE statement this WHERE clause is part of. */ public Options using(Using using) { return statement.using(using); }
/** * Adds an option to the DELETE statement these conditions are part of. * * @param using the using clause to add. * @return the options of the DELETE statement these conditions are part of. */ public Options using(Using using) { return statement.using(using); } }
/** * Adds an option to the DELETE statement this WHERE clause is part of. * * @param using the using clause to add. * @return the options of the DELETE statement this WHERE clause is part of. */ public Options using(Using using) { return statement.using(using); }
/** * Adds an option to the DELETE statement this WHERE clause is part of. * * @param using the using clause to add. * @return the options of the DELETE statement this WHERE clause is part of. */ public Options using(Using using) { return statement.using(using); }
/** * Adds an option to the DELETE statement these conditions are part of. * * @param using the using clause to add. * @return the options of the DELETE statement these conditions are part of. */ public Options using(Using using) { return statement.using(using); } }
delete = delete("a", "b", "c").from("foo").using(timestamp(0)).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().from("foo").using(timestamp(-1240003134L)); fail("Expected an IllegalArgumentException"); } catch (IllegalArgumentException e) {
@Override public DeleteBuilder<T> withTtl(int ttl) { delete.using(QueryBuilder.ttl(ttl)); return this; } @Override
@Override public DeleteBuilder<T> withTimeStamp(long timeStamp) { delete.using(QueryBuilder.timestamp(timeStamp)); return this; }
/** * Add common {@link WriteOptions} options to {@link Delete} CQL statements. * * @param delete {@link Delete} CQL statement, must not be {@literal null}. * @param writeOptions write options (e.g. consistency level) to add to the CQL statement. * @return the given {@link Delete}. * @since 2.1 */ public static Delete addWriteOptions(Delete delete, WriteOptions writeOptions) { Assert.notNull(delete, "Update must not be null"); addQueryOptions(delete, writeOptions); if (writeOptions.getTimestamp() != null) { delete.using(QueryBuilder.timestamp(writeOptions.getTimestamp())); } return delete; }
@Override void modifyQueryString(BuiltStatement query) { if (query instanceof Insert) { ((Insert) query).using().and(QueryBuilder.timestamp(QueryBuilder.bindMarker())); } else if (query instanceof Delete) { ((Delete) query).using().and(QueryBuilder.timestamp(QueryBuilder.bindMarker())); } else { throw new AssertionError("Unexpected query type: " + query.getClass()); } }
private static String deleteQueryWithTimestamp(TableMetadata tableMetadata) { Delete delete = QueryBuilder.delete().from(tableMetadata); delete.using(QueryBuilder.timestamp(QueryBuilder.bindMarker())); Delete.Where where = delete.where(); List<ColumnMetadata> columns = tableMetadata.getPrimaryKey(); for(ColumnMetadata column : columns) { where.and(QueryBuilder.eq(column.getName(), QueryBuilder.bindMarker())); } return delete.toString(); }
delete = delete("a", "b", "c").from("baz", "foo").using(timestamp(0)).where(eq("k", 1)); assertEquals(delete.toString(), query); assertThat(delete.getKeyspace()).isEqualTo("baz"); // keyspace set since provided. 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().from("foo").using(timestamp(-1240003134L)); fail("Expected an IllegalArgumentException"); } catch (IllegalArgumentException e) {