Class Union
java.lang.Object
com.northconcepts.datapipeline.jdbc.sql.SqlPart
com.northconcepts.datapipeline.jdbc.sql.select.QuerySource
com.northconcepts.datapipeline.jdbc.sql.select.Union
Combines several
Select queries with UNION or UNION ALL; can be nested in another query as a source.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppends queries to the union; at least one must be given.clear()voidcollectParameterValues(List<Object> values) Appends the values for this part's?parameters to the list in order; adds nothing by default.voidcollectSqlFragment(CodeWriter writer) Writes this part's SQL to the writer; used bySqlPart.getSqlFragment()and by enclosing parts.booleancontainsTable(String table) Returns true if this source, a nested source or a join refers to the table (ignoring case).getTable()Returns the first table in the list of tables.Returns the tables this source reads from, including those of nested sources but not joined tables.booleanisAll()Indicates if the queries are combined withUNION ALLinstead ofUNION(default is false).setAll(boolean all) Indicates if the queries are combined withUNION ALLinstead ofUNION(default is false).setNestedAlias(String nestedAlias) Sets the alias written after this source in a FROM clause (nullfor none).setPretty(boolean pretty) Indicates ifSqlPart.getSqlFragment()adds line breaks and indentation instead of using one line (default is false).Methods inherited from class com.northconcepts.datapipeline.jdbc.sql.select.QuerySource
getNestedAlias, shouldWrapWhenNestedMethods inherited from class com.northconcepts.datapipeline.jdbc.sql.SqlPart
getParameterValues, getSqlFragment, isPretty, printSqlParts, toString
-
Constructor Details
-
Union
Creates a union of the given queries; at least one is required.
-
-
Method Details
-
add
Appends queries to the union; at least one must be given. -
clear
-
getSelects
-
isAll
public boolean isAll()Indicates if the queries are combined withUNION ALLinstead ofUNION(default is false). -
setAll
Indicates if the queries are combined withUNION ALLinstead ofUNION(default is false). -
setPretty
Description copied from class:SqlPartIndicates ifSqlPart.getSqlFragment()adds line breaks and indentation instead of using one line (default is false).- Overrides:
setPrettyin classQuerySource
-
setNestedAlias
Description copied from class:QuerySourceSets the alias written after this source in a FROM clause (nullfor none).- Overrides:
setNestedAliasin classQuerySource
-
getTables
Description copied from class:QuerySourceReturns the tables this source reads from, including those of nested sources but not joined tables.- Specified by:
getTablesin classQuerySource
-
getTable
Description copied from class:QuerySourceReturns the first table in the list of tables.
If this query source involves more than one table, useQuerySource.getTables()instead of this method.- Specified by:
getTablein classQuerySource
-
containsTable
Description copied from class:QuerySourceReturns true if this source, a nested source or a join refers to the table (ignoring case).- Specified by:
containsTablein classQuerySource
-
collectSqlFragment
Description copied from class:SqlPartWrites this part's SQL to the writer; used bySqlPart.getSqlFragment()and by enclosing parts.- Specified by:
collectSqlFragmentin classSqlPart
-
collectParameterValues
Description copied from class:SqlPartAppends the values for this part's?parameters to the list in order; adds nothing by default.- Overrides:
collectParameterValuesin classSqlPart
-