public interface Relation extends CqlSnippet
To build instances of this type, use the factory methods, such as column
, token
, etc.
They are used as arguments to the where
method, for
example:
selectFrom("foo").all().where(Relation.column("k").isEqualTo(literal(1)))
// SELECT * FROM foo WHERE k=1
There are also shortcuts in the fluent API when you build a statement, for example:
selectFrom("foo").all().whereColumn("k").isEqualTo(literal(1))
// SELECT * FROM foo WHERE k=1
appendTo
@NonNull static ColumnRelationBuilder<Relation> column(@NonNull CqlIdentifier id)
This must be chained with an operator call, for example:
Relation r = Relation.column("k").isEqualTo(bindMarker());
@NonNull static ColumnRelationBuilder<Relation> column(@NonNull String name)
column(CqlIdentifier.fromCql(name))
@NonNull static ColumnComponentRelationBuilder<Relation> mapValue(@NonNull CqlIdentifier columnId, @NonNull Term index)
@NonNull static ColumnComponentRelationBuilder<Relation> mapValue(@NonNull String columnName, @NonNull Term index)
mapValue(CqlIdentifier.fromCql(columnName),
index)
@NonNull static TokenRelationBuilder<Relation> tokenFromIds(@NonNull Iterable<CqlIdentifier> identifiers)
@NonNull static TokenRelationBuilder<Relation> token(@NonNull CqlIdentifier... identifiers)
tokenFromIds(Iterable)
.@NonNull static TokenRelationBuilder<Relation> token(@NonNull Iterable<String> names)
tokenFromIds(Iterable)
with raw strings; the names are converted with
CqlIdentifier.fromCql(String)
.@NonNull static TokenRelationBuilder<Relation> token(@NonNull String... names)
token(Iterable)
.@NonNull static MultiColumnRelationBuilder<Relation> columnIds(@NonNull Iterable<CqlIdentifier> identifiers)
WHERE (c1, c2, c3) IN ...
.@NonNull static MultiColumnRelationBuilder<Relation> columns(@NonNull CqlIdentifier... identifiers)
columnIds(Iterable)
.@NonNull static MultiColumnRelationBuilder<Relation> columns(@NonNull Iterable<String> names)
columnIds(Iterable)
with raw strings; the names are converted with
CqlIdentifier.fromCql(String)
.@NonNull static MultiColumnRelationBuilder<Relation> columns(@NonNull String... names)
columns(Iterable)
.@NonNull static Relation customIndex(@NonNull CqlIdentifier indexId, @NonNull Term expression)
@NonNull static Relation customIndex(@NonNull String indexName, @NonNull Term expression)
boolean isIdempotent()
That is, whether it always selects the same rows when used multiple times. For example,
WHERE c=1
is idempotent, WHERE c=now()
isn't.
This is used internally by the query builder to compute the Request.isIdempotent()
flag on the UPDATE and DELETE statements generated by BuildableQuery.build()
(this is
not relevant for SELECT statement, which are always idempotent). If a term is ambiguous (for
example a raw snippet or a call to a user function in the right operands), the builder is
pessimistic and assumes the term is not idempotent.
Copyright © 2017–2022. All rights reserved.