public interface BuildableQuery
The API returns this type as soon as there is enough information for a minimal query (in most cases, it's still possible to call more methods to keep building).
Modifier and Type | Method and Description |
---|---|
String |
asCql()
Builds the CQL query as a raw string.
|
default SimpleStatement |
build()
Builds the CQL query and wraps it in a simple statement.
|
default SimpleStatement |
build(Map<String,Object> namedValues)
Builds the CQL query and wraps it in a simple statement, also providing named values for bind
markers.
|
default SimpleStatement |
build(Object... values)
Builds the CQL query and wraps it in a simple statement, also providing positional values for
bind markers.
|
default SimpleStatementBuilder |
builder()
Builds the CQL query and wraps it in a simple statement builder.
|
@NonNull String asCql()
Use this if you plan to pass the query to SyncCqlSession.execute(String)
or SyncCqlSession.prepare(String)
without any further customization.
@NonNull default SimpleStatement build()
This is a similar to:
SimpleStatement.newInstance(asCql())
In addition, some implementations might try to infer additional statement properties (such as
Request.isIdempotent()
).@NonNull default SimpleStatement build(@NonNull Object... values)
This is a similar to:
SimpleStatement.newInstance(asCql(), values)
In addition, some implementations might try to infer additional statement properties (such as
Request.isIdempotent()
).@NonNull default SimpleStatement build(@NonNull Map<String,Object> namedValues)
This is a similar to:
SimpleStatement.newInstance(asCql(), namedValues)
In addition, some implementations might try to infer additional statement properties (such as
Request.isIdempotent()
).@NonNull default SimpleStatementBuilder builder()
This is equivalent to build()
, but the builder might be slightly more efficient if
you plan to customize multiple properties on the statement, for example:
SimpleStatementBuilder builder =
selectFrom("foo")
.all()
.whereColumn("k").isEqualTo(bindMarker("k"))
.whereColumn("c").isLessThan(bindMarker("c"))
.builder();
SimpleStatement statement =
builder.addNamedValue("k", 1).addNamedValue("c", 2).setTracing().build();
In addition, some implementations might try to infer additional statement properties (such as
Request.isIdempotent()
).Copyright © 2017–2023. All rights reserved.