Represents a SELECT statement (simple, or union).
| Methods |
| static void |
initOrder(Session session, ArrayList expressions, ArrayList expressionSQL, ArrayList orderList, int visible, boolean mustBeInResult, ArrayList filters)
Initialize the order by list.
|
| static void |
initOrder(Session session, ArrayList expressions, ArrayList expressionSQL, ArrayList orderList, int visible, boolean mustBeInResult, ArrayList filters)
Initialize the order by list. This call may extend the expressions list.
Parameters:
session - the session
expressions - the select list expressions
expressionSQL - the select list SQL snippets
orderList - the order by list
visible - the number of visible columns in the select list
mustBeInResult - all order by expressions must be in the select list
filters - the table filters
|
| void |
addGlobalCondition(Parameter param, int columnId, int comparisonType)
Add a condition to the query.
|
| void |
addGlobalCondition(Parameter param, int columnId, int comparisonType)
Add a condition to the query. This is used for views.
Parameters:
param - the parameter
columnId - the column index (0 meaning the first column)
comparisonType - the comparison type
|
| void |
addParameter(Parameter param)
Add a parameter to the parameter list.
|
| void |
addParameter(Parameter param)
Add a parameter to the parameter list.
Parameters:
param - the parameter to add
|
| boolean |
allowGlobalConditions()
Check whether adding condition to the query is allowed.
|
| boolean |
allowGlobalConditions()
Check whether adding condition to the query is allowed. This is not
allowed for views that have an order by and a limit, as it would affect
the returned results.
Returns:
true if adding global conditions is allowed
|
| void |
disableCache()
Disable caching of result sets.
|
| void |
disableCache()
Disable caching of result sets.
|
| void |
fireBeforeSelectTriggers()
Call the before triggers on all tables.
|
| void |
fireBeforeSelectTriggers()
Call the before triggers on all tables.
|
| int |
getColumnCount()
Get the column count of this query.
|
| int |
getColumnCount()
Get the column count of this query.
Returns:
the column count
|
| double |
getCost()
Calculate the cost to execute this query.
|
| double |
getCost()
Calculate the cost to execute this query.
Returns:
the cost
|
| int |
getCostAsExpression()
Calculate the cost when used as a subquery.
|
| int |
getCostAsExpression()
Calculate the cost when used as a subquery.
This method returns a value between 10 and 1000000,
to ensure adding other values can't result in an integer overflow.
Returns:
the estimated cost as an integer
|
| ArrayList |
getExpressions()
The the list of select expressions.
|
| ArrayList |
getExpressions()
The the list of select expressions.
This may include invisible expressions such as order by expressions.
Returns:
the list of expressions
|
| Expression |
getLimit()
|
| Expression |
getLimit()
|
| long |
getMaxDataModificationId()
|
| long |
getMaxDataModificationId()
|
| Expression |
getOffset()
|
| Expression |
getOffset()
|
| Value[] |
getParameterValues()
|
| Value[] |
getParameterValues()
|
| int |
getSampleSizeValue(Session session)
Get the sample size, if set.
|
| int |
getSampleSizeValue(Session session)
Get the sample size, if set.
Parameters:
session - the session
Returns:
the sample size
|
| HashSet |
getTables()
Get all tables that are involved in this query.
|
| HashSet |
getTables()
Get all tables that are involved in this query.
Returns:
the set of tables
|
| boolean |
hasOrder()
Whether the query has an order.
|
| boolean |
hasOrder()
Whether the query has an order.
Returns:
true if it has
|
| void |
init()
Initialize the query.
|
| void |
init()
Initialize the query.
|
| boolean |
isDistinct()
|
| boolean |
isDistinct()
|
| boolean |
isEverything(ExpressionVisitor visitor)
Check if this expression and all sub-expressions can fulfill a criteria.
|
| boolean |
isEverything(ExpressionVisitor visitor)
Check if this expression and all sub-expressions can fulfill a criteria.
If any part returns false, the result is false.
Parameters:
visitor - the visitor
Returns:
if the criteria can be fulfilled
|
| boolean |
isNeverLazy()
|
| boolean |
isNeverLazy()
|
| boolean |
isQuery()
|
| boolean |
isQuery()
|
| boolean |
isTransactional()
|
| boolean |
isTransactional()
|
| boolean |
isUnion()
Check if this is a UNION query.
|
| boolean |
isUnion()
Check if this is a UNION query.
Returns:
{@code true} if this is a UNION query
|
| void |
mapColumns(ColumnResolver resolver, int level)
Map the columns to the given column resolver.
|
| void |
mapColumns(ColumnResolver resolver, int level)
Map the columns to the given column resolver.
Parameters:
resolver - the resolver
level - the subquery level (0 is the top level query, 1 is the first
subquery level)
|
| void |
prepareJoinBatch()
Prepare join batching.
|
| void |
prepareJoinBatch()
Prepare join batching.
|
| SortOrder |
prepareOrder(ArrayList orderList, int expressionCount)
Create a
|
| SortOrder |
prepareOrder(ArrayList orderList, int expressionCount)
Create a {@link SortOrder} object given the list of {@link SelectOrderBy}
objects. The expression list is extended if necessary.
Parameters:
orderList - a list of {@link SelectOrderBy} elements
expressionCount - the number of columns in the query
Returns:
the {@link SortOrder} object
|
| ResultInterface |
query(int maxrows)
|
| ResultInterface |
query(int maxrows)
|
| ResultInterface |
query(int limit, ResultTarget target)
Execute the query, writing the result to the target result.
|
| ResultInterface |
query(int limit, ResultTarget target)
Execute the query, writing the result to the target result.
Parameters:
limit - the maximum number of rows to return
target - the target result (null will return the result)
Returns:
the result set (if the target is not set).
|
| ResultInterface |
queryWithoutCache(int limit, ResultTarget target)
Execute the query without checking the cache.
|
| ResultInterface |
queryWithoutCache(int limit, ResultTarget target)
Execute the query without checking the cache. If a target is specified,
the results are written to it, and the method returns null. If no target
is specified, a new LocalResult is created and returned.
Parameters:
limit - the limit as specified in the JDBC method call
target - the target to write results to
Returns:
the result
|
| void |
setDistinct(boolean b)
Set the distinct flag.
|
| void |
setDistinct(boolean b)
Set the distinct flag.
Parameters:
b - the new value
|
| void |
setEvaluatable(TableFilter tableFilter, boolean b)
Change the evaluatable flag.
|
| void |
setEvaluatable(TableFilter tableFilter, boolean b)
Change the evaluatable flag. This is used when building the execution
plan.
Parameters:
tableFilter - the table filter
b - the new value
|
| void |
setForUpdate(boolean forUpdate)
Set the 'for update' flag.
|
| void |
setForUpdate(boolean forUpdate)
Set the 'for update' flag.
Parameters:
forUpdate - the new setting
|
| void |
setLimit(Expression limit)
|
| void |
setLimit(Expression limit)
|
| void |
setNeverLazy(boolean b)
|
| void |
setNeverLazy(boolean b)
|
| void |
setOffset(Expression offset)
|
| void |
setOffset(Expression offset)
|
| void |
setOrder(ArrayList order)
Set the order by list.
|
| void |
setOrder(ArrayList order)
Set the order by list.
Parameters:
order - the order by list
|
| void |
setRandomAccessResult(boolean b)
Whether results need to support random access.
|
| void |
setRandomAccessResult(boolean b)
Whether results need to support random access.
Parameters:
b - the new value
|
| void |
setSampleSize(Expression sampleSize)
|
| void |
setSampleSize(Expression sampleSize)
|
| void |
updateAggregate(Session s)
Update all aggregate function values.
|
| void |
updateAggregate(Session s)
Update all aggregate function values.
Parameters:
s - the session
|
Whether the result must only contain distinct rows.
The limit expression as specified in the LIMIT or TOP clause.
The offset expression as specified in the LIMIT .. OFFSET clause.
Whether the result needs to support random access.
The sample size expression as specified in the SAMPLE_SIZE clause.