select = select().fcall("* FROM bar; --", column("b")).from("foo"); assertEquals(select.toString(), query);
.execute( select() .fcall("avg", cast(column("i"), DataType.cfloat())) .as("iavg") .from(TABLE2)
.column(VALUE_COLUMN_NAME) .fcall(WRITETIME_FUNCTION_NAME, column(VALUE_COLUMN_NAME)).as(WRITETIME_COLUMN_NAME) .fcall(TTL_FUNCTION_NAME, column(VALUE_COLUMN_NAME)).as(TTL_COLUMN_NAME) .from(this.storeManager.getKeyspaceName(), this.tableName) .where(eq(KEY_COLUMN_NAME, bindMarker(KEY_BINDING))) .column(VALUE_COLUMN_NAME) .fcall(WRITETIME_FUNCTION_NAME, column(VALUE_COLUMN_NAME)).as(WRITETIME_COLUMN_NAME) .fcall(TTL_FUNCTION_NAME, column(VALUE_COLUMN_NAME)).as(TTL_COLUMN_NAME) .from(this.storeManager.getKeyspaceName(), this.tableName) .allowFiltering() .column(VALUE_COLUMN_NAME) .fcall(WRITETIME_FUNCTION_NAME, column(VALUE_COLUMN_NAME)).as(WRITETIME_COLUMN_NAME) .fcall(TTL_FUNCTION_NAME, column(VALUE_COLUMN_NAME)).as(TTL_COLUMN_NAME) .from(this.storeManager.getKeyspaceName(), this.tableName) .allowFiltering()
select = select().fcall("* FROM bar; --", column("b")).from("foo"); assertEquals(select.toString(), query);
pos++; result = result.fcall(selFunction.getName(), innerFunction);
.execute( select() .fcall("avg", cast(column("i"), DataType.cfloat())) .as("iavg") .from(TABLE2)
/** * Generate a SELECT ... <strong>writetime(QueryBuilder.column("value")) AS write_time</strong> ... */ public final EntityWithComplexTypes_Select.Cols writeTime() { selection.fcall("writetime",QueryBuilder.column("value")).as("write_time"); return this; }
/** * Generate a SELECT ... <strong>writetime(QueryBuilder.column("value")) AS write_time</strong> ... */ public final EntityWithComplexTypes_Select.Cols writeTime() { select.fcall("writetime",QueryBuilder.column("value")).as("write_time"); return new EntityWithComplexTypes_Select.Cols(select); }
private static SelectionOrAlias getSelection(Selection selection, Selector selector) { if (selector instanceof FunctionCall) { Object[] objects = ((FunctionCall) selector).getParameters().stream().map(param -> { if (param instanceof ColumnSelector) { return QueryBuilder.column(((ColumnSelector) param).getExpression()); } return param; }).toArray(); return selection.fcall(selector.getExpression(), objects); } return selection.column(selector.getExpression()); }
/** * Generate a SELECT ... <strong>writetime(QueryBuilder.column("value")) AS write_time</strong> ... */ public final EntityWithComplexTypes_Select.ColsTM writeTime() { selection.fcall("writetime",QueryBuilder.column("value")).as("write_time"); return this; }
/** * Generate a SELECT ... <strong>writetime(QueryBuilder.column("value")) AS write_time_2</strong> ... */ public final EntityWithComplexTypes_Select.Cols writeTimeWithCodec() { selection.fcall("writetime",QueryBuilder.column("value")).as("write_time_2"); return this; }
/** * Generate a SELECT ... <strong>writetime(QueryBuilder.column("value")) AS write_time_2</strong> ... */ public final EntityWithComplexTypes_Select.Cols writeTimeWithCodec() { select.fcall("writetime",QueryBuilder.column("value")).as("write_time_2"); return new EntityWithComplexTypes_Select.Cols(select); }
private ImmutableList<BuiltStatement> idempotentBuiltStatements() { return ImmutableList.<BuiltStatement>of( update("foo").with(set("v", 1)).where(eq("k", 1)), // set simple value update("foo").with(add("s", 1)).where(eq("k", 1)), // add to set update("foo").with(put("m", "a", 1)).where(eq("k", 1)), // put in map // select statements should be idempotent even with function calls select().countAll().from("foo").where(eq("k", 1)), select().ttl("v").from("foo").where(eq("k", 1)), select().writeTime("v").from("foo").where(eq("k", 1)), select().fcall("token", "k").from("foo").where(eq("k", 1))); }
/** * Generate a SELECT ... <strong>writetime(QueryBuilder.column("value")) AS write_time_2</strong> ... */ public final EntityWithComplexTypes_Select.ColsTM writeTimeWithCodec() { selection.fcall("writetime",QueryBuilder.column("value")).as("write_time_2"); return this; }
private ImmutableList<BuiltStatement> idempotentBuiltStatements() { return ImmutableList.<BuiltStatement>of( update("foo").with(set("v", 1)).where(eq("k", 1)), // set simple value update("foo").with(add("s", 1)).where(eq("k", 1)), // add to set update("foo").with(put("m", "a", 1)).where(eq("k", 1)), // put in map // select statements should be idempotent even with function calls select().countAll().from("foo").where(eq("k", 1)), select().ttl("v").from("foo").where(eq("k", 1)), select().writeTime("v").from("foo").where(eq("k", 1)), select().fcall("token", "k").from("foo").where(eq("k", 1))); }