public class Select extends Query
create, parameters, prepareAlways, session, sqlStatement, sqlTokens| 构造器和说明 |
|---|
Select(SessionLocal session,
Select parentSelect) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addCondition(Expression cond)
Add a condition to the list of conditions.
|
void |
addGlobalCondition(Parameter param,
int columnId,
int comparisonType)
Add a condition to the query.
|
void |
addTableFilter(TableFilter filter,
boolean isTop)
Add a table to the query.
|
boolean |
addWindow(String name,
Window window)
Adds a named window definition.
|
boolean |
allowGlobalConditions()
Check whether adding condition to the query is allowed.
|
void |
fireBeforeSelectTriggers()
Call the before triggers on all tables.
|
Expression |
getCondition() |
double |
getCost()
Calculate the cost to execute this query.
|
ArrayList<Expression> |
getGroupBy() |
SelectGroups |
getGroupDataIfCurrent(boolean window)
Get the group data if there is currently a group-by active.
|
Expression |
getHaving() |
Expression |
getIfSingleRow()
If this query is determined as a single-row query, returns a replacement
expression.
|
Select |
getParentSelect()
Returns parent select, or null.
|
String |
getPlanSQL(int sqlFlags)
Get the SQL statement with the execution plan.
|
Expression |
getQualify() |
SortOrder |
getSortOrder() |
HashSet<Table> |
getTables()
Get all tables that are involved in this query.
|
ArrayList<TableFilter> |
getTopFilters() |
TableFilter |
getTopTableFilter() |
Window |
getWindow(String name)
Returns a window with specified name, or null.
|
void |
init()
Initialize the query.
|
boolean |
isAnyDistinct() |
boolean |
isCacheable() |
boolean |
isConstantQuery()
Check if this query will always return the same value and has no side
effects.
|
boolean |
isEverything(ExpressionVisitor visitor)
Check if this expression and all sub-expressions can fulfill a criteria.
|
boolean |
isGroupQuery()
Checks if this query is a group query.
|
boolean |
isGroupWindowStage2()
Checks if window stage of group window query is performed.
|
boolean |
isQuickAggregateQuery()
Check if this is an aggregate query with direct lookup, for example a
query of the type SELECT COUNT(*) FROM TEST or
SELECT MAX(ID) FROM TEST.
|
boolean |
isUnion()
Check if this is a UNION query.
|
boolean |
isWindowQuery()
Checks if this query contains window functions.
|
void |
mapColumns(ColumnResolver resolver,
int level)
Map the columns to the given column resolver.
|
void |
prepareExpressions() |
void |
preparePlan() |
protected ResultInterface |
queryWithoutCache(long maxRows,
ResultTarget target)
Execute the query without checking the cache.
|
void |
setDistinct()
Set the distinct flag.
|
void |
setDistinct(Expression[] distinctExpressions)
Set the DISTINCT ON expressions.
|
void |
setEvaluatable(TableFilter tableFilter,
boolean b)
Change the evaluatable flag.
|
void |
setExplicitTable()
Convert this SELECT to an explicit table (TABLE tableName).
|
void |
setExpressions(ArrayList<Expression> expressions) |
void |
setForUpdate(boolean b)
Set the 'for update' flag.
|
void |
setGroupBy(ArrayList<Expression> group) |
void |
setGroupQuery()
Set when SELECT statement contains (non-window) aggregate functions,
GROUP BY clause or HAVING clause.
|
void |
setHaving(Expression having) |
void |
setQualify(Expression qualify) |
void |
setWildcard()
Sets a wildcard expression as in "SELECT * FROM TEST".
|
void |
setWindowQuery()
Called if this query contains window functions.
|
void |
updateAggregate(SessionLocal s,
int stage)
Update all aggregate function values.
|
collectDependencies, disableCache, exists, getColumnCount, getCostAsExpression, getExpressions, getFetch, getMaxDataModificationId, getOffset, getRowDataType, getType, hasOrder, isFetchPercent, isNeverLazy, isQuery, isRandomAccessResult, isReadOnly, isStandardDistinct, isTransactional, isWithTies, prepare, query, query, queryMeta, setDistinctIfPossible, setFetch, setFetchPercent, setNeverLazy, setOffset, setOrder, setRandomAccessResult, setWithTies, toTablecheckCanceled, checkParameters, getCteCleanups, getCurrentRowNumber, getObjectId, getParameters, getPersistedObjectId, getSession, getSimpleSQL, getSQL, getSQLTokens, isWithParamValues, needRecompile, setCommand, setCteCleanups, setCurrentRowNumber, setParameterList, setPersistedObjectId, setPrepareAlways, setRow, setSession, setSQL, setWithParamValues, toString, updatepublic Select(SessionLocal session, Select parentSelect)
public boolean isUnion()
Querypublic void addTableFilter(TableFilter filter, boolean isTop)
filter - the table to addisTop - if the table can be the first table in the query planpublic ArrayList<TableFilter> getTopFilters()
public void setExpressions(ArrayList<Expression> expressions)
public void setExplicitTable()
public void setWildcard()
public void setGroupQuery()
public void setWindowQuery()
public void setGroupBy(ArrayList<Expression> group)
public ArrayList<Expression> getGroupBy()
public SelectGroups getGroupDataIfCurrent(boolean window)
window - is this a window functionpublic void setDistinct()
public void setDistinct(Expression[] distinctExpressions)
distinctExpressions - array of expressionspublic boolean isAnyDistinct()
isAnyDistinct 在类中 QueryDISTINCT or
DISTINCT ON (...) querypublic boolean addWindow(String name, Window window)
name - namewindow - window definitionpublic Window getWindow(String name)
name - name of the windowpublic void addCondition(Expression cond)
cond - the condition to addpublic Expression getCondition()
protected ResultInterface queryWithoutCache(long maxRows, ResultTarget target)
QueryqueryWithoutCache 在类中 QuerymaxRows - the limit as specified in the JDBC method calltarget - the target to write results topublic void prepareExpressions()
prepareExpressions 在类中 Querypublic void preparePlan()
preparePlan 在类中 Querypublic double getCost()
Querypublic HashSet<Table> getTables()
Querypublic void fireBeforeSelectTriggers()
QueryfireBeforeSelectTriggers 在类中 Querypublic String getPlanSQL(int sqlFlags)
PreparedgetPlanSQL 在类中 PreparedsqlFlags - formatting flagspublic void setHaving(Expression having)
public Expression getHaving()
public void setQualify(Expression qualify)
public Expression getQualify()
public TableFilter getTopTableFilter()
public void setForUpdate(boolean b)
QuerysetForUpdate 在类中 Queryb - the new settingpublic void mapColumns(ColumnResolver resolver, int level)
QuerymapColumns 在类中 Queryresolver - the resolverlevel - the subquery level (0 is the top level query, 1 is the first
subquery level)public void setEvaluatable(TableFilter tableFilter, boolean b)
QuerysetEvaluatable 在类中 QuerytableFilter - the table filterb - the new valuepublic boolean isQuickAggregateQuery()
public boolean isGroupQuery()
public boolean isWindowQuery()
public boolean isGroupWindowStage2()
public void addGlobalCondition(Parameter param, int columnId, int comparisonType)
QueryaddGlobalCondition 在类中 Queryparam - the parametercolumnId - the column index (0 meaning the first column)comparisonType - the comparison typepublic void updateAggregate(SessionLocal s, int stage)
QueryupdateAggregate 在类中 Querys - the sessionstage - select stagepublic boolean isEverything(ExpressionVisitor visitor)
QueryisEverything 在类中 Queryvisitor - the visitorpublic boolean isCacheable()
isCacheable 在类中 Preparedpublic boolean allowGlobalConditions()
QueryallowGlobalConditions 在类中 Querypublic SortOrder getSortOrder()
public Select getParentSelect()
public boolean isConstantQuery()
QueryisConstantQuery 在类中 Querypublic Expression getIfSingleRow()
QuerygetIfSingleRow 在类中 QuerynullCopyright © 2022. All rights reserved.