public abstract class Query extends Prepared
Modifier and Type | Field and Description |
---|---|
protected boolean |
distinct
Whether the result must only contain distinct rows.
|
protected Expression |
limitExpr
The limit expression as specified in the LIMIT or TOP clause.
|
protected Expression |
offsetExpr
The offset expression as specified in the LIMIT ..
|
protected boolean |
randomAccessResult
Whether the result needs to support random access.
|
protected Expression |
sampleSizeExpr
The sample size expression as specified in the SAMPLE_SIZE clause.
|
create, parameters, prepareAlways, session, sqlStatement
Modifier and Type | Method and Description |
---|---|
abstract void |
addGlobalCondition(Parameter param,
int columnId,
int comparisonType)
Add a condition to the query.
|
abstract boolean |
allowGlobalConditions()
Check whether adding condition to the query is allowed.
|
void |
disableCache()
Disable caching of result sets.
|
abstract void |
fireBeforeSelectTriggers()
Call the before triggers on all tables.
|
abstract int |
getColumnCount()
Get the column count of this query.
|
abstract double |
getCost()
Calculate the cost to execute this query.
|
int |
getCostAsExpression()
Calculate the cost when used as a subquery.
|
abstract ArrayList<Expression> |
getExpressions()
The the list of select expressions.
|
Expression |
getLimit() |
long |
getMaxDataModificationId() |
Expression |
getOffset() |
Value[] |
getParameterValues() |
abstract HashSet<Table> |
getTables()
Get all tables that are involved in this query.
|
abstract boolean |
hasOrder()
Whether the query has an order.
|
abstract void |
init()
Initialize the query.
|
boolean |
isDistinct() |
abstract boolean |
isEverything(ExpressionVisitor visitor)
Check if this expression and all sub-expressions can fulfill a criteria.
|
boolean |
isNeverLazy() |
boolean |
isQuery()
Check if this object is a query.
|
boolean |
isTransactional()
Check if this command is transactional.
|
abstract boolean |
isUnion()
Check if this is a UNION query.
|
abstract void |
mapColumns(ColumnResolver resolver,
int level)
Map the columns to the given column resolver.
|
abstract void |
prepareJoinBatch()
Prepare join batching.
|
SortOrder |
prepareOrder(ArrayList<SelectOrderBy> orderList,
int expressionCount)
Create a
SortOrder object given the list of SelectOrderBy
objects. |
ResultInterface |
query(int maxrows)
Execute the query.
|
ResultInterface |
query(int limit,
ResultTarget target)
Execute the query, writing the result to the target result.
|
protected abstract ResultInterface |
queryWithoutCache(int limit,
ResultTarget target)
Execute the query without checking the cache.
|
void |
setDistinct(boolean b)
Set the distinct flag.
|
abstract void |
setEvaluatable(TableFilter tableFilter,
boolean b)
Change the evaluatable flag.
|
abstract void |
setForUpdate(boolean forUpdate)
Set the 'for update' flag.
|
void |
setLimit(Expression limit) |
void |
setNeverLazy(boolean b) |
void |
setOffset(Expression offset) |
abstract void |
setOrder(ArrayList<SelectOrderBy> order)
Set the order by list.
|
void |
setRandomAccessResult(boolean b)
Whether results need to support random access.
|
void |
setSampleSize(Expression sampleSize) |
abstract void |
updateAggregate(Session s)
Update all aggregate function values.
|
checkCanceled, checkParameters, getCteCleanups, getCurrentObjectId, getCurrentRowNumber, getObjectId, getParameters, getPlanSQL, getSession, getSQL, getSQL, getSQL, getType, isCacheable, isReadOnly, needRecompile, prepare, queryMeta, setCommand, setCteCleanups, setCurrentRowNumber, setObjectId, setParameterList, setPrepareAlways, setRow, setSession, setSQL, toString, update
protected Expression limitExpr
protected Expression offsetExpr
protected Expression sampleSizeExpr
protected boolean distinct
protected boolean randomAccessResult
public void setNeverLazy(boolean b)
public boolean isNeverLazy()
public abstract boolean isUnion()
true
if this is a UNION querypublic abstract void prepareJoinBatch()
protected abstract ResultInterface queryWithoutCache(int limit, ResultTarget target)
limit
- the limit as specified in the JDBC method calltarget
- the target to write results topublic abstract void init()
public abstract ArrayList<Expression> getExpressions()
public abstract double getCost()
public int getCostAsExpression()
public abstract HashSet<Table> getTables()
public abstract void setOrder(ArrayList<SelectOrderBy> order)
order
- the order by listpublic abstract boolean hasOrder()
public abstract void setForUpdate(boolean forUpdate)
forUpdate
- the new settingpublic abstract int getColumnCount()
public abstract void mapColumns(ColumnResolver resolver, int level)
resolver
- the resolverlevel
- the subquery level (0 is the top level query, 1 is the first
subquery level)public abstract void setEvaluatable(TableFilter tableFilter, boolean b)
tableFilter
- the table filterb
- the new valuepublic abstract void addGlobalCondition(Parameter param, int columnId, int comparisonType)
param
- the parametercolumnId
- the column index (0 meaning the first column)comparisonType
- the comparison typepublic abstract boolean allowGlobalConditions()
public abstract boolean isEverything(ExpressionVisitor visitor)
visitor
- the visitorpublic abstract void updateAggregate(Session s)
s
- the sessionpublic abstract void fireBeforeSelectTriggers()
public void setDistinct(boolean b)
b
- the new valuepublic boolean isDistinct()
public void setRandomAccessResult(boolean b)
b
- the new valuepublic boolean isQuery()
Prepared
public boolean isTransactional()
Prepared
isTransactional
in class Prepared
public void disableCache()
public final Value[] getParameterValues()
public final ResultInterface query(int maxrows)
Prepared
public final ResultInterface query(int limit, ResultTarget target)
limit
- the maximum number of rows to returntarget
- the target result (null will return the result)public SortOrder prepareOrder(ArrayList<SelectOrderBy> orderList, int expressionCount)
SortOrder
object given the list of SelectOrderBy
objects. The expression list is extended if necessary.orderList
- a list of SelectOrderBy
elementsexpressionCount
- the number of columns in the querySortOrder
objectpublic void setOffset(Expression offset)
public Expression getOffset()
public void setLimit(Expression limit)
public Expression getLimit()
public void setSampleSize(Expression sampleSize)
public final long getMaxDataModificationId()
Copyright © 2020 JBoss by Red Hat. All rights reserved.