public final class SqlBuilder extends Object
import static com.feedzai.commons.sql.abstraction.dml.dialect.SqlBuilder.*;
(...)
select(all()).from(table("TABLE_NAME"))
Constructor and Description |
---|
SqlBuilder() |
Modifier and Type | Method and Description |
---|---|
static Expression |
all()
Selects all columns in a row.
|
static Expression |
all(String tableName)
Selects all columns in a table.
|
static AlterColumn |
alterColumn(Expression table,
DbColumn dbColumn)
Alter column operator.
|
static AlterColumn |
alterColumn(Expression table,
Name column,
DbColumnType dbColumnType,
DbColumnConstraint... constraints)
Alter column operator.
|
static Expression |
and(Collection<? extends Expression> exps)
The AND operator.
|
static Expression |
and(Expression... exps)
The AND operator.
|
static Expression |
avg(Expression exp)
The AVG operator.
|
static Between |
between(Expression exp1,
Expression exp2,
Expression exp3)
The BETWEEN operator.
|
static Coalesce |
coalesce(Expression exp,
Expression... alternative)
The coalesce operator.
|
static Name |
column(String name)
A column.
|
static Name |
column(String tableName,
String name)
A column from a table.
|
static Expression |
count(Expression exp)
The COUNT operator.
|
static View |
createView(String name)
Creates a view.
|
static DbColumn.Builder |
dbColumn()
Creates a Database Column builder.
|
static DbColumn.Builder |
dbColumn(String name,
DbColumnType type)
Creates a Database Column builder.
|
static DbColumn.Builder |
dbColumn(String name,
DbColumnType type,
boolean autoInc)
Creates a Database Column builder.
|
static DbColumn.Builder |
dbColumn(String name,
DbColumnType type,
int size)
Creates a Database Column builder.
|
static DbEntity.Builder |
dbEntity()
Creates a Database Entity builder.
|
static DbFk.Builder |
dbFk()
Creates a Database Foreign Key builder.
|
static DbIndex.Builder |
dbIndex()
Creates a Database Index builder.
|
static Delete |
delete(Expression table)
The DELETE keyword.
|
static Expression |
div(Collection<? extends Expression> exps)
The DIV operator.
|
static Expression |
div(Expression... exps)
The DIV operator.
|
static DropPrimaryKey |
dropPK(Expression table)
Drop primary key table operator.
|
static EntityEntry.Builder |
entry()
Creates a Database Entry builder.
|
static Expression |
eq(Collection<? extends Expression> e1)
The equals expression.
|
static Expression |
eq(Expression... e1)
The equals expression.
|
static Expression |
f(String function)
An internal function (provided by the engine in place).
|
static Expression |
f(String function,
Expression exp)
An internal function (provided by the engine in place).
|
static Expression |
gt(Collection<? extends Expression> exps)
The GT operator.
|
static Expression |
gt(Expression... exps)
The GT operator.
|
static Expression |
gteq(Collection<? extends Expression> exps)
The GTEQ operator.
|
static Expression |
gteq(Expression... exps)
The GTEQ operator.
|
static Expression |
in(Expression e1,
Expression e2)
The IN expression.
|
static Expression |
join(Expression e1,
Expression e2)
The same of making eq(e1, e2).
|
static Expression |
k(Object o)
A constant.
|
static Expression |
L(Collection<? extends Expression> exps)
A list of expression enclosed.
|
static Expression |
L(Expression... exps)
A list of expressions enclosed.
|
static Expression |
like(Collection<? extends Expression> exps)
The LIKE operator.
|
static Expression |
like(Expression... exps)
The LIKE operator.
|
static Literal |
lit(Object o)
Use this to add literals (strings, etc) when building the SQL statement.
|
static Expression |
lower(Expression exp)
The LOWER operator.
|
static Expression |
lt(Collection<? extends Expression> exps)
The LT operator.
|
static Expression |
lt(Expression... exps)
The LT operator.
|
static Expression |
lteq(Collection<? extends Expression> exps)
The LTEQ operator.
|
static Expression |
lteq(Expression... exps)
The LTEQ operator.
|
static Expression |
max(Expression exp)
The MAX operator.
|
static Expression |
min(Expression exp)
The MIN operator.
|
static Expression |
minus(Collection<? extends Expression> exps)
The MINUS operator.
|
static Expression |
minus(Expression... exps)
The MINUS operator.
|
static Expression |
mod(Expression exp1,
Expression exp2)
The MOD operator.
|
static Expression |
mult(Collection<? extends Expression> exps)
The MULT operator.
|
static Expression |
mult(Expression... exps)
The MULT operator.
|
static Expression |
neq(Collection<? extends Expression> exps)
The not equal expression.
|
static Expression |
neq(Expression... exps)
The not equal expression.
|
static Between |
notBetween(Expression exp1,
Expression exp2,
Expression exp3)
The NOT BETWEEN operator.
|
static Expression |
notIn(Expression e1,
Expression e2)
The NOT IN expression.
|
static Expression |
or(Collection<? extends Expression> exps)
The OR operator.
|
static Expression |
or(Expression... exps)
The OR operator.
|
static Expression |
plus(Collection<? extends Expression> exps)
The PLUS operator.
|
static Expression |
plus(Expression... exps)
The PLUS operator.
|
static Rename |
rename(Expression oldName,
Expression newName)
Rename table operator.
|
static Query |
select(Collection<? extends Expression> select)
Starts a new query.
|
static Query |
select(Expression... select)
Starts a new query.
|
static Expression |
stddev(Expression exp)
The STDDEV operator.
|
static Expression |
sum(Expression exp)
The SUM operator.
|
static Name |
table(String name)
A table.
|
static Truncate |
truncate(Expression table)
The TRUNCATE keyword.
|
static Expression |
udf(String udf)
The Used Defined Function operator.
|
static Expression |
udf(String udf,
Expression exp)
The Used Defined Function operator.
|
static Update |
update(Expression table)
The UPDATE operator.
|
static Expression |
upper(Expression exp)
The UPPER operator.
|
public static Query select(Expression... select)
select
- The objects.public static Query select(Collection<? extends Expression> select)
select
- The collection of select columns.public static Expression all()
public static Expression all(String tableName)
tableName
- The table.public static Name column(String name)
name
- The column name.public static Name column(String tableName, String name)
tableName
- The table name.name
- The column name.public static Name table(String name)
name
- The table name.public static Expression eq(Expression... e1)
e1
- The expressions.public static Expression eq(Collection<? extends Expression> e1)
e1
- The expressions.public static Expression k(Object o)
o
- The constant.public static Expression and(Expression... exps)
exps
- The expressions.public static Expression and(Collection<? extends Expression> exps)
exps
- The expressions.public static Expression or(Expression... exps)
exps
- The expressions.public static Expression or(Collection<? extends Expression> exps)
exps
- The expressions.public static Expression div(Expression... exps)
exps
- The expressions.public static Expression div(Collection<? extends Expression> exps)
exps
- The expressions.public static Expression mod(Expression exp1, Expression exp2)
exp1
- The dividend.exp2
- The divisor.public static Expression gt(Expression... exps)
exps
- The expressions.public static Expression gt(Collection<? extends Expression> exps)
exps
- The expressions.public static Expression gteq(Expression... exps)
exps
- The expressions.public static Expression gteq(Collection<? extends Expression> exps)
exps
- The expressions.public static Expression like(Expression... exps)
exps
- The expressions.public static Expression like(Collection<? extends Expression> exps)
exps
- The expressions.public static Expression lt(Expression... exps)
exps
- The expressions.public static Expression lt(Collection<? extends Expression> exps)
exps
- The expressions.public static Expression lteq(Expression... exps)
exps
- The expressions.public static Expression lteq(Collection<? extends Expression> exps)
exps
- The expressions.public static Expression minus(Expression... exps)
exps
- The expressions.public static Expression minus(Collection<? extends Expression> exps)
exps
- The expressions.public static Expression mult(Expression... exps)
exps
- The expressions.public static Expression mult(Collection<? extends Expression> exps)
exps
- The expressions.public static Expression plus(Expression... exps)
exps
- The expressions.public static Expression plus(Collection<? extends Expression> exps)
exps
- The expressions.public static Expression max(Expression exp)
exp
- The expression.public static Expression min(Expression exp)
exp
- The expression.public static Expression stddev(Expression exp)
exp
- The expression.public static Expression avg(Expression exp)
exp
- The expression.public static Expression count(Expression exp)
exp
- The expression.public static Expression sum(Expression exp)
exp
- The expression.public static Expression udf(String udf)
udf
- The UDF name.public static Expression udf(String udf, Expression exp)
udf
- The UDF name.exp
- The expression.public static Expression upper(Expression exp)
exp
- The expression inside the operator.public static Expression lower(Expression exp)
exp
- The expression inside the operator.public static Expression f(String function)
function
- The function.public static final Expression f(String function, Expression exp)
function
- The function.exp
- The expression.public static Expression join(Expression e1, Expression e2)
e1
- The first expression.e2
- The second expression.public static View createView(String name)
name
- The name of the view.public static Expression neq(Expression... exps)
exps
- The expressions.public static Expression neq(Collection<? extends Expression> exps)
exps
- The expressions.public static Expression L(Expression... exps)
exps
- The expressions.public static Expression L(Collection<? extends Expression> exps)
exps
- The expressions.public static Expression in(Expression e1, Expression e2)
e1
- The first expression.e2
- The second expression.public static Expression notIn(Expression e1, Expression e2)
e1
- The first expression.e2
- The second expression.public static Coalesce coalesce(Expression exp, Expression... alternative)
exp
- The expression to test if is NULL.alternative
- The alternative expressions to use.public static Between between(Expression exp1, Expression exp2, Expression exp3)
exp1
- The column.exp2
- The first bound.exp3
- The second bound.public static Between notBetween(Expression exp1, Expression exp2, Expression exp3)
exp1
- The column.exp2
- The first bound.exp3
- The second bound.public static Update update(Expression table)
table
- The table.public static Delete delete(Expression table)
table
- The table.public static Literal lit(Object o)
o
- The literal.public static Truncate truncate(Expression table)
table
- The table.public static Rename rename(Expression oldName, Expression newName)
oldName
- The table.public static DropPrimaryKey dropPK(Expression table)
table
- The table.public static AlterColumn alterColumn(Expression table, Name column, DbColumnType dbColumnType, DbColumnConstraint... constraints)
table
- The table containing the column.column
- The column of the table.dbColumnType
- The db column type.constraints
- The constraints of the column.public static AlterColumn alterColumn(Expression table, DbColumn dbColumn)
table
- The table containing the column.dbColumn
- The database column definition.public static DbFk.Builder dbFk()
public static DbEntity.Builder dbEntity()
public static DbIndex.Builder dbIndex()
public static DbColumn.Builder dbColumn()
public static DbColumn.Builder dbColumn(String name, DbColumnType type, boolean autoInc)
public static DbColumn.Builder dbColumn(String name, DbColumnType type)
public static DbColumn.Builder dbColumn(String name, DbColumnType type, int size)
public static EntityEntry.Builder entry()
Copyright © 2014 Feedzai. All Rights Reserved.