Class SelectBuilder
java.lang.Object
org.eclipse.dirigible.database.sql.builders.AbstractSqlBuilder
org.eclipse.dirigible.database.sql.builders.AbstractQuerySqlBuilder
org.eclipse.dirigible.database.sql.builders.records.SelectBuilder
- All Implemented Interfaces:
ISqlBuilder,ISqlKeywords
public class SelectBuilder extends AbstractQuerySqlBuilder
The Select Builder.
-
Field Summary
Fields inherited from interface org.eclipse.dirigible.database.sql.ISqlKeywords
ALTER, CLOSE, COMMA, EQUALS, FUNCTION_CURRENT_DATE, FUNCTION_CURRENT_TIME, FUNCTION_CURRENT_TIMESTAMP, KEYWORD_ADD, KEYWORD_ALTER, KEYWORD_AND, KEYWORD_AS, KEYWORD_ASC, KEYWORD_CHECK, KEYWORD_COLUMN, KEYWORD_COLUMNSTORE, KEYWORD_CONSTRAINT, KEYWORD_CREATE, KEYWORD_DATA, KEYWORD_DATABASE_DROP_RESTRICT, KEYWORD_DELETE, KEYWORD_DESC, KEYWORD_DISTINCT, KEYWORD_DROP, KEYWORD_FETCH, KEYWORD_FOR, KEYWORD_FOR_UPDATE, KEYWORD_FOREIGN, KEYWORD_FROM, KEYWORD_FULL, KEYWORD_GLOBAL_TEMPORARY, KEYWORD_GLOBAL_TEMPORARY_COLUMN, KEYWORD_GROUP_BY, KEYWORD_HAVING, KEYWORD_IDENTITY, KEYWORD_INDEX, KEYWORD_INNER, KEYWORD_INSERT, KEYWORD_INTO, KEYWORD_JOIN, KEYWORD_KEY, KEYWORD_LEFT, KEYWORD_LIKE, KEYWORD_LIMIT, KEYWORD_NEXT, KEYWORD_NEXT_VALUE_FOR, KEYWORD_NO, KEYWORD_NOT, KEYWORD_NULL, KEYWORD_OFFSET, KEYWORD_ON, KEYWORD_ONLY, KEYWORD_OR, KEYWORD_ORDER_BY, KEYWORD_OUTER, KEYWORD_PRIMARY, KEYWORD_PUBLIC, KEYWORD_REFERENCES, KEYWORD_RIGHT, KEYWORD_ROW, KEYWORD_ROWS, KEYWORD_ROWSTORE, KEYWORD_SCHEMA, KEYWORD_SELECT, KEYWORD_SEQUENCE, KEYWORD_SEQUENCE_CYCLE, KEYWORD_SEQUENCE_EMPTY_STRING_FOR_BOOLEAN_TYPES, KEYWORD_SEQUENCE_INCREMENT_BY, KEYWORD_SEQUENCE_MAXVALUE, KEYWORD_SEQUENCE_MINVALUE, KEYWORD_SEQUENCE_NO_MAXVALUE, KEYWORD_SEQUENCE_NO_MINVALUE, KEYWORD_SEQUENCE_RESET_BY, KEYWORD_SEQUENCE_RESTART_WITH, KEYWORD_SEQUENCE_START_WITH, KEYWORD_SET, KEYWORD_START, KEYWORD_SYNONYM, KEYWORD_TABLE, KEYWORD_TABLE_TYPE, KEYWORD_UNION, KEYWORD_UNIQUE, KEYWORD_UPDATE, KEYWORD_VALUES, KEYWORD_VIEW, KEYWORD_WHERE, KEYWORD_WITH, METADATA_ALIAS, METADATA_BASE_TABLE, METADATA_CALC_VIEW, METADATA_GLOBAL_TEMPORARY, METADATA_GLOBAL_TEMPORARY_COLUMN, METADATA_LOCAL_TEMPORARY, METADATA_SYNONYM, METADATA_SYSTEM_TABLE, METADATA_TABLE, METADATA_TABLE_TYPES, METADATA_VIEW, OPEN, QUESTION, SEMICOLON, SPACE, STAR, TABLE, UNDERSCROE -
Constructor Summary
Constructors Constructor Description SelectBuilder(ISqlDialect dialect)Instantiates a new select builder. -
Method Summary
Modifier and Type Method Description SelectBuildercolumn(String column)Column.SelectBuilderdistinct()Distinct.SelectBuilderforUpdate()For update.SelectBuilderfrom(String table)From.SelectBuilderfrom(String table, String alias)From.SelectBuilderfullJoin(String table, String on)Full join.SelectBuilderfullJoin(String table, String on, String alias)Full join.Stringgenerate()Generate.protected voidgenerateColumns(StringBuilder sql)Generate columns.protected voidgenerateDistinct(StringBuilder sql)Generate distinct.protected voidgenerateForUpdate(StringBuilder sql)Generate for update.protected voidgenerateGroupBy(StringBuilder sql)Generate group by.protected voidgenerateHaving(StringBuilder sql)Generate having.protected voidgenerateJoins(StringBuilder sql)Generate joins.protected voidgenerateSelect(StringBuilder sql)Generate select.protected voidgenerateTables(StringBuilder sql)Generate tables.protected voidgenerateUnion(StringBuilder sql)Generate union.SelectBuildergenericJoin(String type, String table, String on, String alias)Generic join.List<String>getColumns()Gets the columns.List<String>getGroups()Gets the groups.StringgetHaving()Gets the having.List<String>getJoins()Gets the joins.intgetLimit()Gets the limit.intgetOffset()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.SelectBuildergroup(String column)Group.SelectBuilderhaving(String having)Having.SelectBuilderinnerJoin(String table, String on)Inner join.SelectBuilderinnerJoin(String table, String on, String alias)Inner join.booleanisDistinct()Checks if is distinct.booleanisForUpdate()Checks if is for update.SelectBuilderjoin(String table, String on)Join.SelectBuilderjoin(String table, String on, String alias)Join.SelectBuilderleftJoin(String table, String on)Left join.SelectBuilderleftJoin(String table, String on, String alias)Left join.SelectBuilderlimit(int limit)Limit.SelectBuilderlimit(Double limit)Limit.SelectBuilderoffset(int offset)Offset.SelectBuilderoffset(Double offset)Offset.SelectBuilderorder(String column)Order.SelectBuilderorder(String column, boolean asc)Order.SelectBuilderouterJoin(String table, String on)Outer join.SelectBuilderouterJoin(String table, String on, String alias)Outer join.SelectBuilderrightJoin(String table, String on)Right join.SelectBuilderrightJoin(String table, String on, String alias)Right join.protected StringtraverseColumns()Traverse columns.protected StringtraverseGroups()Traverse groups.protected StringtraverseJoins()Traverse joins.protected StringtraverseTables()Traverse tables.protected StringtraverseUnions()Traverse unions.SelectBuilderunion(String select)Union.SelectBuilderwhere(String condition)Where.Methods inherited from class org.eclipse.dirigible.database.sql.builders.AbstractQuerySqlBuilder
generateCreate, generateLimitAndOffset, generateOrderBy, generateWhere, toStringMethods inherited from class org.eclipse.dirigible.database.sql.builders.AbstractSqlBuilder
build, encapsulate, encapsulate, encapsulateMany, getDialect, getEscapeSymbol, isCaseSensitive, isColumn, isNumeric, isValue
-
Constructor Details
-
SelectBuilder
Instantiates a new select builder.- Parameters:
dialect- the dialect
-
-
Method Details
-
distinct
Distinct.- Returns:
- the select builder
-
forUpdate
For update.- Returns:
- the select builder
-
column
Column.- Parameters:
column- the column- Returns:
- the select builder
-
from
From.- Parameters:
table- the table- Returns:
- the select builder
-
from
From.- Parameters:
table- the tablealias- the alias- Returns:
- the select builder
-
join
Join.- Parameters:
table- the tableon- the on- Returns:
- the select builder
-
join
Join.- Parameters:
table- the tableon- the onalias- the alias- Returns:
- the select builder
-
innerJoin
Inner join.- Parameters:
table- the tableon- the on- Returns:
- the select builder
-
innerJoin
Inner join.- Parameters:
table- the tableon- the onalias- the alias- Returns:
- the select builder
-
outerJoin
Outer join.- Parameters:
table- the tableon- the on- Returns:
- the select builder
-
outerJoin
Outer join.- Parameters:
table- the tableon- the onalias- the alias- Returns:
- the select builder
-
leftJoin
Left join.- Parameters:
table- the tableon- the on- Returns:
- the select builder
-
leftJoin
Left join.- Parameters:
table- the tableon- the onalias- the alias- Returns:
- the select builder
-
rightJoin
Right join.- Parameters:
table- the tableon- the on- Returns:
- the select builder
-
rightJoin
Right join.- Parameters:
table- the tableon- the onalias- the alias- Returns:
- the select builder
-
fullJoin
Full join.- Parameters:
table- the tableon- the on- Returns:
- the select builder
-
fullJoin
Full join.- Parameters:
table- the tableon- the onalias- the alias- Returns:
- the select builder
-
genericJoin
Generic join.- Parameters:
type- the typetable- the tableon- the onalias- the alias- Returns:
- the select builder
-
where
Where.- Parameters:
condition- the condition- Returns:
- the select builder
-
order
Order.- Parameters:
column- the column- Returns:
- the select builder
-
order
Order.- Parameters:
column- the columnasc- the asc- Returns:
- the select builder
-
group
Group.- Parameters:
column- the column- Returns:
- the select builder
-
limit
Limit.- Parameters:
limit- the limit- Returns:
- the select builder
-
limit
Limit.- Parameters:
limit- the limit- Returns:
- the select builder
-
offset
Offset.- Parameters:
offset- the offset- Returns:
- the select builder
-
offset
Offset.- Parameters:
offset- the offset- Returns:
- the select builder
-
having
Having.- Parameters:
having- the having- Returns:
- the select builder
-
union
Union.- Parameters:
select- the select- Returns:
- the select builder
-
generate
Generate.- Returns:
- the string
-
generateUnion
Generate union.- Parameters:
sql- the sql
-
generateHaving
Generate having.- Parameters:
sql- the sql
-
generateGroupBy
Generate group by.- Parameters:
sql- the sql
-
generateJoins
Generate joins.- Parameters:
sql- the sql
-
generateTables
Generate tables.- Parameters:
sql- the sql
-
generateColumns
Generate columns.- Parameters:
sql- the sql
-
generateDistinct
Generate distinct.- Parameters:
sql- the sql
-
generateForUpdate
Generate for update.- Parameters:
sql- the sql
-
traverseColumns
Traverse columns.- Returns:
- the string
-
traverseTables
Traverse tables.- Returns:
- the string
-
traverseJoins
Traverse joins.- Returns:
- the string
-
traverseGroups
Traverse groups.- Returns:
- the string
-
traverseUnions
Traverse unions.- Returns:
- the string
-
generateSelect
Generate select.- Parameters:
sql- the sql
-
getColumns
Gets the columns.- Returns:
- the columns
-
getTables
Gets the tables.- Returns:
- the tables
-
getJoins
Gets the joins.- Returns:
- the joins
-
getWheres
Gets the wheres.- Returns:
- the wheres
-
getOrders
Gets the orders.- Returns:
- the orders
-
getGroups
Gets the groups.- Returns:
- the groups
-
getUnions
Gets the unions.- Returns:
- the unions
-
isDistinct
public boolean isDistinct()Checks if is distinct.- Returns:
- true, if is distinct
-
getHaving
Gets the having.- Returns:
- the having
-
getLimit
public int getLimit()Gets the limit.- Returns:
- the limit
-
getOffset
public int getOffset()Gets the offset.- Returns:
- the offset
-
isForUpdate
public boolean isForUpdate()Checks if is for update.- Returns:
- true, if is for update
-