public abstract class CQLBuilder extends Object
CQLBuilder
and more efficient, comparing to write Cassandra CQL in plain text.
cql()
or pair()
method must be called to release resources.
String cql = NE.insert("gui", "firstName", "lastName").into("account").cql();
// CQL: INSERT INTO account (gui, first_name, last_name) VALUES (:gui, :firstName, :lastName)
tableName
will NOT be formalized.
select(...).from(String tableName).where(...)
insert(...).into(String tableName).values(...)
update(String tableName).set(...).where(...)
deleteFrom(String tableName).where(...)
ConditionFactory
,
ConditionFactory.CF
Modifier and Type | Class and Description |
---|---|
static class |
CQLBuilder.ACCB
Deprecated.
PAC or NAC is preferred. |
static class |
CQLBuilder.CP |
static class |
CQLBuilder.LCCB
Deprecated.
PLC or NLC is preferred. |
static class |
CQLBuilder.NAC
Named CQL builder with all capitals case (upper case with underscore) field/column naming strategy.
|
static class |
CQLBuilder.NLC
Named SQL builder with lower camel case field/column naming strategy.
|
static class |
CQLBuilder.NSB
Named SQL builder with
NamingPolicy.NO_CHANGE field/column naming strategy. |
static class |
CQLBuilder.NSC
Named CQL builder with snake case (lower case with underscore) field/column naming strategy.
|
static class |
CQLBuilder.PAC
Parameterized('?') CQL builder with all capitals case (upper case with underscore) field/column naming strategy.
|
static class |
CQLBuilder.PLC
Parameterized('?') CQL builder with lower camel case field/column naming strategy.
|
static class |
CQLBuilder.PSB
Parameterized('?') SQL builder with
NamingPolicy.NO_CHANGE field/column naming strategy. |
static class |
CQLBuilder.PSC
Parameterized('?') CQL builder with snake case (lower case with underscore) field/column naming strategy.
|
static class |
CQLBuilder.SCCB
Deprecated.
PSC or NSC is preferred. |
Modifier and Type | Field and Description |
---|---|
static String |
COUNT_ALL |
static String |
DISTINCT |
Modifier and Type | Method and Description |
---|---|
<E extends Exception> |
accept(com.landawn.abacus.util.Throwables.BiConsumer<? super String,? super List<Object>,E> consumer) |
<E extends Exception> |
accept(com.landawn.abacus.util.Throwables.Consumer<? super CQLBuilder.CP,E> consumer) |
CQLBuilder |
allowFiltering() |
CQLBuilder |
append(com.landawn.abacus.condition.Condition cond) |
CQLBuilder |
append(String expr) |
<T,E extends Exception> |
apply(com.landawn.abacus.util.Throwables.BiFunction<? super String,? super List<Object>,T,E> func) |
<T,E extends Exception> |
apply(com.landawn.abacus.util.Throwables.Function<? super CQLBuilder.CP,T,E> func) |
String |
cql()
This CQLBuilder will be closed after
cql() is called. |
CQLBuilder |
distinct() |
CQLBuilder |
from(Class<?> entityClass) |
CQLBuilder |
from(Class<?> entityClass,
String alias) |
CQLBuilder |
from(Collection<String> tableNames) |
CQLBuilder |
from(String... tableNames) |
CQLBuilder |
from(String expr) |
CQLBuilder |
iF(com.landawn.abacus.condition.Condition cond) |
CQLBuilder |
iF(String expr) |
CQLBuilder |
ifExists() |
CQLBuilder |
ifNotExists()
If not exists.
|
CQLBuilder |
into(Class<?> entityClass) |
CQLBuilder |
into(String tableName) |
CQLBuilder |
limit(int count) |
CQLBuilder |
orderBy(Collection<String> columnNames) |
CQLBuilder |
orderBy(Collection<String> columnNames,
com.landawn.abacus.util.SortDirection direction) |
CQLBuilder |
orderBy(Map<String,com.landawn.abacus.util.SortDirection> orders) |
CQLBuilder |
orderBy(String... columnNames) |
CQLBuilder |
orderBy(String expr) |
CQLBuilder |
orderBy(String columnName,
com.landawn.abacus.util.SortDirection direction) |
CQLBuilder.CP |
pair()
This CQLBuilder will be closed after
pair() is called. |
List<Object> |
parameters() |
CQLBuilder |
preselect(String preselect) |
void |
println() |
static String |
repeatQM(int n)
Repeat question mark(
? ) n times with delimiter ", " . |
CQLBuilder |
set(Class<?> entityClass) |
CQLBuilder |
set(Class<?> entityClass,
Set<String> excludedPropNames) |
CQLBuilder |
set(Collection<String> columnNames) |
CQLBuilder |
set(Map<String,Object> props) |
CQLBuilder |
set(Object entity)
Only the dirty properties will be set into the result SQL if the specified entity is a dirty marker entity.
|
CQLBuilder |
set(Object entity,
Set<String> excludedPropNames)
Only the dirty properties will be set into the result SQL if the specified entity is a dirty marker entity.
|
CQLBuilder |
set(String... columnNames) |
CQLBuilder |
set(String expr) |
String |
toString() |
CQLBuilder |
usingTimestamp(Date timestamp) |
CQLBuilder |
usingTimestamp(long timestamp) |
CQLBuilder |
usingTimestamp(String timestamp) |
CQLBuilder |
usingTTL(long timestamp) |
CQLBuilder |
usingTTL(String timestamp) |
CQLBuilder |
where(com.landawn.abacus.condition.Condition cond) |
CQLBuilder |
where(String expr) |
public static final String DISTINCT
public static final String COUNT_ALL
public static String repeatQM(int n)
?
) n
times with delimiter ", "
.
n
- public CQLBuilder into(String tableName)
tableName
- public CQLBuilder into(Class<?> entityClass)
entityClass
- public CQLBuilder distinct()
public CQLBuilder preselect(String preselect)
preselect
- ALL | DISTINCT | DISTINCTROW...
public CQLBuilder from(String expr)
expr
- @SafeVarargs public final CQLBuilder from(String... tableNames)
tableNames
- public CQLBuilder from(Collection<String> tableNames)
tableNames
- public CQLBuilder from(Class<?> entityClass)
entityClass
- public CQLBuilder from(Class<?> entityClass, String alias)
entityClass
- alias
- public CQLBuilder where(String expr)
expr
- public CQLBuilder where(com.landawn.abacus.condition.Condition cond)
public CQLBuilder orderBy(String expr)
expr
- @SafeVarargs public final CQLBuilder orderBy(String... columnNames)
columnNames
- public CQLBuilder orderBy(String columnName, com.landawn.abacus.util.SortDirection direction)
columnName
- direction
- public CQLBuilder orderBy(Collection<String> columnNames)
columnNames
- public CQLBuilder orderBy(Collection<String> columnNames, com.landawn.abacus.util.SortDirection direction)
columnNames
- direction
- public CQLBuilder orderBy(Map<String,com.landawn.abacus.util.SortDirection> orders)
orders
- public CQLBuilder limit(int count)
count
- public CQLBuilder append(com.landawn.abacus.condition.Condition cond)
public CQLBuilder append(String expr)
public CQLBuilder set(String expr)
expr
- @SafeVarargs public final CQLBuilder set(String... columnNames)
columnNames
- public CQLBuilder set(Collection<String> columnNames)
columnNames
- public CQLBuilder set(Map<String,Object> props)
props
- public CQLBuilder set(Object entity)
entity
- public CQLBuilder set(Object entity, Set<String> excludedPropNames)
entity
- excludedPropNames
- public CQLBuilder set(Class<?> entityClass)
entityClass
- public CQLBuilder set(Class<?> entityClass, Set<String> excludedPropNames)
entityClass
- excludedPropNames
- public CQLBuilder usingTTL(long timestamp)
timestamp
- public CQLBuilder usingTTL(String timestamp)
timestamp
- public CQLBuilder usingTimestamp(Date timestamp)
timestamp
- public CQLBuilder usingTimestamp(long timestamp)
timestamp
- public CQLBuilder usingTimestamp(String timestamp)
timestamp
- public CQLBuilder iF(String expr)
expr
- public CQLBuilder iF(com.landawn.abacus.condition.Condition cond)
cond
- any literal written in Expression
condition won't be formalizedpublic CQLBuilder ifExists()
public CQLBuilder ifNotExists()
public CQLBuilder allowFiltering()
public String cql()
cql()
is called.public CQLBuilder.CP pair()
pair()
is called.public <T,E extends Exception> T apply(com.landawn.abacus.util.Throwables.Function<? super CQLBuilder.CP,T,E> func) throws E extends Exception
E extends Exception
public <T,E extends Exception> T apply(com.landawn.abacus.util.Throwables.BiFunction<? super String,? super List<Object>,T,E> func) throws E extends Exception
E extends Exception
public <E extends Exception> void accept(com.landawn.abacus.util.Throwables.Consumer<? super CQLBuilder.CP,E> consumer) throws E extends Exception
E extends Exception
public <E extends Exception> void accept(com.landawn.abacus.util.Throwables.BiConsumer<? super String,? super List<Object>,E> consumer) throws E extends Exception
E extends Exception
public void println()
Copyright © 2021. All rights reserved.