Package org.h2.command.query
Class TableValueConstructor
java.lang.Object
org.h2.command.Prepared
org.h2.command.query.Query
org.h2.command.query.TableValueConstructor
Table value constructor.
-
Field Summary
Fields inherited from class org.h2.command.Prepared
create, parameters, prepareAlways, session, sqlStatement, sqlTokens -
Constructor Summary
ConstructorsConstructorDescriptionTableValueConstructor(SessionLocal session, ArrayList<ArrayList<Expression>> rows) Creates new instance of table value constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGlobalCondition(Parameter param, int columnId, int comparisonType) Add a condition to the query.booleanCheck whether adding condition to the query is allowed.voidCall the before triggers on all tables.doublegetCost()Calculate the cost to execute this query.If this query is determined as a single-row query, returns a replacement expression.getPlanSQL(StringBuilder builder, int sqlFlags) Appends the SQL statement with the execution plan.Get all tables that are involved in this query.static voidgetValuesSQL(StringBuilder builder, int sqlFlags, ArrayList<ArrayList<Expression>> rows) Appends the SQL of the values to the specified string builder..static voidgetVisibleResult(SessionLocal session, ResultTarget result, Column[] columns, ArrayList<ArrayList<Expression>> rows) Appends visible columns of all rows to the specified result.voidinit()Initialize the query.booleanCheck if this query will always return the same value and has no side effects.booleanisEverything(ExpressionVisitor visitor) Check if this expression and all sub-expressions can fulfill a criteria.booleanisUnion()Check if this is a UNION query.voidmapColumns(ColumnResolver resolver, int level, boolean outer) Map the columns to the given column resolver.voidvoidprotected ResultInterfacequeryWithoutCache(long limit, ResultTarget target) Execute the query without checking the cache.voidsetEvaluatable(TableFilter tableFilter, boolean b) Change the evaluatable flag.voidsetForUpdate(ForUpdate forUpdate) Set the FOR UPDATE clause.toTable(String alias, Column[] columnTemplates, ArrayList<Parameter> parameters, boolean forCreateView, Query topQuery) Converts this query to a table or a view.voidupdateAggregate(SessionLocal s, int stage) Update all aggregate function values.Methods inherited from class org.h2.command.query.Query
collectDependencies, disableCache, exists, getColumnCount, getCostAsExpression, getExpressions, getFetch, getForUpdate, getMaxDataModificationId, getOffset, getOuterQueryScope, getRowDataType, getType, hasOrder, invalidateCachedResult, isAnyDistinct, isFetchPercent, isInPredicateResult, isNeverLazy, isQuery, isReadOnly, isRetryable, isStandardDistinct, isTransactional, isWithTies, prepare, query, query, queryMeta, setDistinctIfPossible, setFetch, setFetchPercent, setInPredicateResult, setInPredicateResultSortTypes, setNeverLazy, setOffset, setOrder, setOuterQueryScope, setWithClause, setWithTies, writeWithListMethods inherited from class org.h2.command.Prepared
checkCanceled, checkParameters, getCurrentRowNumber, getDatabase, getObjectId, getParameters, getPersistedObjectId, getPlanSQL, getSession, getSimpleSQL, getSQL, getSQLTokens, isCacheable, isWithParamValues, needRecompile, setCommand, setCurrentRowNumber, setParameterList, setPersistedObjectId, setPrepareAlways, setRow, setSession, setSQL, setWithParamValues, toString, update
-
Constructor Details
-
TableValueConstructor
Creates new instance of table value constructor.- Parameters:
session- the sessionrows- the rows
-
-
Method Details
-
getVisibleResult
public static void getVisibleResult(SessionLocal session, ResultTarget result, Column[] columns, ArrayList<ArrayList<Expression>> rows) Appends visible columns of all rows to the specified result.- Parameters:
session- the sessionresult- the resultcolumns- the columnsrows- the rows with data
-
getValuesSQL
public static void getValuesSQL(StringBuilder builder, int sqlFlags, ArrayList<ArrayList<Expression>> rows) Appends the SQL of the values to the specified string builder..- Parameters:
builder- string buildersqlFlags- formatting flagsrows- the values
-
isUnion
public boolean isUnion()Description copied from class:QueryCheck if this is a UNION query. -
queryWithoutCache
Description copied from class:QueryExecute 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.- Specified by:
queryWithoutCachein classQuery- Parameters:
limit- the limit as specified in the JDBC method calltarget- the target to write results to- Returns:
- the result
-
init
public void init()Description copied from class:QueryInitialize the query. -
prepareExpressions
public void prepareExpressions()- Specified by:
prepareExpressionsin classQuery
-
preparePlan
public void preparePlan()- Specified by:
preparePlanin classQuery
-
getCost
public double getCost()Description copied from class:QueryCalculate the cost to execute this query. -
getTables
Description copied from class:QueryGet all tables that are involved in this query. -
setForUpdate
Description copied from class:QuerySet the FOR UPDATE clause.- Specified by:
setForUpdatein classQuery- Parameters:
forUpdate- the new FOR UPDATE clause
-
mapColumns
Description copied from class:QueryMap the columns to the given column resolver.- Specified by:
mapColumnsin classQuery- Parameters:
resolver- the resolverlevel- the subquery level (0 is the top level query, 1 is the first subquery level)outer- whether this method was called from the outer query
-
setEvaluatable
Description copied from class:QueryChange the evaluatable flag. This is used when building the execution plan.- Specified by:
setEvaluatablein classQuery- Parameters:
tableFilter- the table filterb- the new value
-
addGlobalCondition
Description copied from class:QueryAdd a condition to the query. This is used for views.- Specified by:
addGlobalConditionin classQuery- Parameters:
param- the parametercolumnId- the column index (0 meaning the first column)comparisonType- the comparison type
-
allowGlobalConditions
public boolean allowGlobalConditions()Description copied from class:QueryCheck 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.- Specified by:
allowGlobalConditionsin classQuery- Returns:
- true if adding global conditions is allowed
-
isEverything
Description copied from class:QueryCheck if this expression and all sub-expressions can fulfill a criteria. If any part returns false, the result is false.- Specified by:
isEverythingin classQuery- Parameters:
visitor- the visitor- Returns:
- if the criteria can be fulfilled
-
updateAggregate
Description copied from class:QueryUpdate all aggregate function values.- Specified by:
updateAggregatein classQuery- Parameters:
s- the sessionstage- select stage
-
fireBeforeSelectTriggers
public void fireBeforeSelectTriggers()Description copied from class:QueryCall the before triggers on all tables.- Specified by:
fireBeforeSelectTriggersin classQuery
-
getPlanSQL
Description copied from class:PreparedAppends the SQL statement with the execution plan.- Overrides:
getPlanSQLin classPrepared- Parameters:
builder- string buildersqlFlags- formatting flags- Returns:
- the execution plan
-
toTable
public Table toTable(String alias, Column[] columnTemplates, ArrayList<Parameter> parameters, boolean forCreateView, Query topQuery) Description copied from class:QueryConverts this query to a table or a view. -
isConstantQuery
public boolean isConstantQuery()Description copied from class:QueryCheck if this query will always return the same value and has no side effects.- Overrides:
isConstantQueryin classQuery- Returns:
- if this query will always return the same value and has no side effects.
-
getIfSingleRow
Description copied from class:QueryIf this query is determined as a single-row query, returns a replacement expression.- Overrides:
getIfSingleRowin classQuery- Returns:
- the expression, or
null
-