public class SelectBuilder extends AbstractQuerySqlBuilder
ALTER, CLOSE, COMMA, EQUALS, FUNCTION_CURRENT_DATE, FUNCTION_CURRENT_TIME, FUNCTION_CURRENT_TIMESTAMP, KEYWORD_AND, KEYWORD_AS, KEYWORD_ASC, KEYWORD_CHECK, KEYWORD_COLUMN, KEYWORD_CONSTRAINT, KEYWORD_CREATE, KEYWORD_DELETE, KEYWORD_DESC, KEYWORD_DISTINCT, KEYWORD_DROP, KEYWORD_FETCH, KEYWORD_FOR_UPDATE, KEYWORD_FOREIGN, KEYWORD_FROM, KEYWORD_FULL, KEYWORD_GROUP_BY, KEYWORD_HAVING, KEYWORD_IDENTITY, KEYWORD_INDEX, KEYWORD_INNER, KEYWORD_INSERT, KEYWORD_INTO, KEYWORD_JOIN, KEYWORD_KEY, KEYWORD_LEFT, KEYWORD_LIMIT, KEYWORD_NEXT, KEYWORD_NEXT_VALUE_FOR, KEYWORD_NOT, KEYWORD_NULL, KEYWORD_OFFSET, KEYWORD_ON, KEYWORD_ONLY, KEYWORD_OR, KEYWORD_ORDER_BY, KEYWORD_OUTER, KEYWORD_PRIMARY, KEYWORD_REFERENCES, KEYWORD_RIGHT, KEYWORD_ROWS, KEYWORD_SELECT, KEYWORD_SEQUENCE, KEYWORD_SET, KEYWORD_START, KEYWORD_TABLE, KEYWORD_UNION, KEYWORD_UNIQUE, KEYWORD_UPDATE, KEYWORD_VALUES, KEYWORD_VIEW, KEYWORD_WHERE, KEYWORD_WITH, METADATA_ALIAS, METADATA_GLOBAL_TEMPORARY, METADATA_LOCAL_TEMPORARY, METADATA_SYNONYM, METADATA_SYSTEM_TABLE, METADATA_TABLE, METADATA_TABLE_TYPES, METADATA_VIEW, OPEN, QUESTION, SPACE, STAR, TABLE, UNDERSCROE| Constructor and Description |
|---|
SelectBuilder(ISqlDialect dialect)
Instantiates a new select builder.
|
| Modifier and Type | Method and Description |
|---|---|
SelectBuilder |
column(String column)
Column.
|
SelectBuilder |
distinct()
Distinct.
|
SelectBuilder |
forUpdate()
For update.
|
SelectBuilder |
from(String table)
From.
|
SelectBuilder |
from(String table,
String alias)
From.
|
SelectBuilder |
fullJoin(String table,
String on)
Full join.
|
SelectBuilder |
fullJoin(String table,
String on,
String alias)
Full join.
|
String |
generate()
Generate the result script.
|
protected void |
generateColumns(StringBuilder sql)
Generate columns.
|
protected void |
generateDistinct(StringBuilder sql)
Generate distinct.
|
protected void |
generateForUpdate(StringBuilder sql)
Generate for update.
|
protected void |
generateGroupBy(StringBuilder sql)
Generate group by.
|
protected void |
generateHaving(StringBuilder sql)
Generate having.
|
protected void |
generateJoins(StringBuilder sql)
Generate joins.
|
protected void |
generateSelect(StringBuilder sql)
Generate select.
|
protected void |
generateTables(StringBuilder sql)
Generate tables.
|
protected void |
generateUnion(StringBuilder sql)
Generate union.
|
SelectBuilder |
genericJoin(String type,
String table,
String on,
String alias)
Generic join.
|
List<String> |
getColumns()
Gets the columns.
|
List<String> |
getGroups()
Gets the groups.
|
String |
getHaving()
Gets the having.
|
List<String> |
getJoins()
Gets the joins.
|
int |
getLimit()
Gets the limit.
|
int |
getOffset()
Gets the offset.
|
List<String> |
getOrders()
Gets the orders.
|
List<String> |
getTables()
Gets the tables.
|
List<String> |
getUnions()
Gets the unions.
|
List<String> |
getWheres()
Gets the wheres.
|
SelectBuilder |
group(String column)
Group.
|
SelectBuilder |
having(String having)
Having.
|
SelectBuilder |
innerJoin(String table,
String on)
Inner join.
|
SelectBuilder |
innerJoin(String table,
String on,
String alias)
Inner join.
|
boolean |
isDistinct()
Checks if is distinct.
|
boolean |
isForUpdate()
Checks if is for update.
|
SelectBuilder |
join(String table,
String on)
Join.
|
SelectBuilder |
join(String table,
String on,
String alias)
Join.
|
SelectBuilder |
leftJoin(String table,
String on)
Left join.
|
SelectBuilder |
leftJoin(String table,
String on,
String alias)
Left join.
|
SelectBuilder |
limit(Double limit)
Limit.
|
SelectBuilder |
limit(int limit)
Limit.
|
SelectBuilder |
offset(Double offset)
Offset.
|
SelectBuilder |
offset(int offset)
Offset.
|
SelectBuilder |
order(String column)
Order.
|
SelectBuilder |
order(String column,
boolean asc)
Order.
|
SelectBuilder |
outerJoin(String table,
String on)
Outer join.
|
SelectBuilder |
outerJoin(String table,
String on,
String alias)
Outer join.
|
SelectBuilder |
rightJoin(String table,
String on)
Right join.
|
SelectBuilder |
rightJoin(String table,
String on,
String alias)
Right join.
|
protected String |
traverseColumns()
Traverse columns.
|
protected String |
traverseGroups()
Traverse groups.
|
protected String |
traverseJoins()
Traverse joins.
|
protected String |
traverseTables()
Traverse tables.
|
protected String |
traverseUnions()
Traverse unions.
|
SelectBuilder |
union(String select)
Union.
|
SelectBuilder |
where(String condition)
Where.
|
generateCreate, generateLimitAndOffset, generateOrderBy, generateWhere, toStringbuild, getDialectpublic SelectBuilder(ISqlDialect dialect)
dialect - the dialectpublic SelectBuilder distinct()
public SelectBuilder forUpdate()
public SelectBuilder column(String column)
column - the columnpublic SelectBuilder from(String table)
table - the tablepublic SelectBuilder from(String table, String alias)
table - the tablealias - the aliaspublic SelectBuilder join(String table, String on)
table - the tableon - the onpublic SelectBuilder join(String table, String on, String alias)
table - the tableon - the onalias - the aliaspublic SelectBuilder innerJoin(String table, String on)
table - the tableon - the onpublic SelectBuilder innerJoin(String table, String on, String alias)
table - the tableon - the onalias - the aliaspublic SelectBuilder outerJoin(String table, String on)
table - the tableon - the onpublic SelectBuilder outerJoin(String table, String on, String alias)
table - the tableon - the onalias - the aliaspublic SelectBuilder leftJoin(String table, String on)
table - the tableon - the onpublic SelectBuilder leftJoin(String table, String on, String alias)
table - the tableon - the onalias - the aliaspublic SelectBuilder rightJoin(String table, String on)
table - the tableon - the onpublic SelectBuilder rightJoin(String table, String on, String alias)
table - the tableon - the onalias - the aliaspublic SelectBuilder fullJoin(String table, String on)
table - the tableon - the onpublic SelectBuilder fullJoin(String table, String on, String alias)
table - the tableon - the onalias - the aliaspublic SelectBuilder genericJoin(String type, String table, String on, String alias)
type - the typetable - the tableon - the onalias - the aliaspublic SelectBuilder where(String condition)
condition - the conditionpublic SelectBuilder order(String column)
column - the columnpublic SelectBuilder order(String column, boolean asc)
column - the columnasc - the ascpublic SelectBuilder group(String column)
column - the columnpublic SelectBuilder limit(int limit)
limit - the limitpublic SelectBuilder limit(Double limit)
limit - the limitpublic SelectBuilder offset(int offset)
offset - the offsetpublic SelectBuilder offset(Double offset)
offset - the offsetpublic SelectBuilder having(String having)
having - the havingpublic SelectBuilder union(String select)
select - the selectpublic String generate()
ISqlBuilderprotected void generateUnion(StringBuilder sql)
sql - the sqlprotected void generateHaving(StringBuilder sql)
sql - the sqlprotected void generateGroupBy(StringBuilder sql)
sql - the sqlprotected void generateJoins(StringBuilder sql)
sql - the sqlprotected void generateTables(StringBuilder sql)
sql - the sqlprotected void generateColumns(StringBuilder sql)
sql - the sqlprotected void generateDistinct(StringBuilder sql)
sql - the sqlprotected void generateForUpdate(StringBuilder sql)
sql - the sqlprotected String traverseColumns()
protected String traverseTables()
protected String traverseJoins()
protected String traverseGroups()
protected String traverseUnions()
protected void generateSelect(StringBuilder sql)
sql - the sqlpublic boolean isDistinct()
public String getHaving()
public int getLimit()
public int getOffset()
public boolean isForUpdate()
Copyright © 2010–2018 Eclipse Foundation. All rights reserved.