Package com.mckoi.database.interpret
Class Planner.QuerySelectColumnSet
- java.lang.Object
-
- com.mckoi.database.interpret.Planner.QuerySelectColumnSet
-
- Enclosing class:
- Planner
private static class Planner.QuerySelectColumnSet extends java.lang.Object
A container object for the set of SelectColumn objects selected in a query.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
aggregate_count
The count of aggregate and constant columns included in the result set.(package private) int
constant_count
The count of aggregate and constant columns included in the result set.private TableExpressionFromSet
from_set
The tables we are selecting from.(package private) java.util.ArrayList
function_col_list
The list of functions in this column set.private static TableName
FUNCTION_TABLE_NAME
The name of the table where functions are defined.private int
running_fun_number
The current number of 'FUNCTIONTABLE.' columns in the table.(package private) java.util.ArrayList
s_col_list
The list of SelectColumn.
-
Constructor Summary
Constructors Constructor Description QuerySelectColumnSet(TableExpressionFromSet from_set)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addAllFromTable(FromTableInterface table)
Adds all columns from the given FromTableInterface object.(package private) Variable
addHiddenFunction(java.lang.String fun_alias, Expression function, QueryContext context)
Adds a new hidden function into the column set.(package private) void
prepare(QueryContext context)
Resolves all variable objects in each column.private void
prepareSelectColumn(SelectColumn col, QueryContext context)
Prepares the given SelectColumn by fully qualifying the expression and allocating it correctly within this context.(package private) void
selectAllColumnsFromAllSources()
Sets up this queriable with all columns from all table sources.(package private) void
selectAllColumnsFromSource(TableName table_name)
Adds all column from the given table object.(package private) void
selectSingleColumn(SelectColumn col)
Adds a single SelectColumn to the list of output columns from the query.
-
-
-
Field Detail
-
FUNCTION_TABLE_NAME
private static TableName FUNCTION_TABLE_NAME
The name of the table where functions are defined.
-
from_set
private TableExpressionFromSet from_set
The tables we are selecting from.
-
s_col_list
java.util.ArrayList s_col_list
The list of SelectColumn.
-
function_col_list
java.util.ArrayList function_col_list
The list of functions in this column set.
-
running_fun_number
private int running_fun_number
The current number of 'FUNCTIONTABLE.' columns in the table. This is incremented for each custom column.
-
aggregate_count
int aggregate_count
The count of aggregate and constant columns included in the result set. Aggregate columns are, (count(*), avg(cost_of) * 0.75, etc). Constant columns are, (9 * 4, 2, (9 * 7 / 4) + 4, etc).
-
constant_count
int constant_count
The count of aggregate and constant columns included in the result set. Aggregate columns are, (count(*), avg(cost_of) * 0.75, etc). Constant columns are, (9 * 4, 2, (9 * 7 / 4) + 4, etc).
-
-
Constructor Detail
-
QuerySelectColumnSet
public QuerySelectColumnSet(TableExpressionFromSet from_set)
Constructor.
-
-
Method Detail
-
selectSingleColumn
void selectSingleColumn(SelectColumn col)
Adds a single SelectColumn to the list of output columns from the query.Note that at this point the the information in the given SelectColumn may not be completely qualified.
-
addAllFromTable
void addAllFromTable(FromTableInterface table)
Adds all columns from the given FromTableInterface object.
-
selectAllColumnsFromSource
void selectAllColumnsFromSource(TableName table_name)
Adds all column from the given table object. This is used to set up the columns that are to be viewed as the result of the select statement.
-
selectAllColumnsFromAllSources
void selectAllColumnsFromAllSources()
Sets up this queriable with all columns from all table sources.
-
addHiddenFunction
Variable addHiddenFunction(java.lang.String fun_alias, Expression function, QueryContext context)
Adds a new hidden function into the column set. This is intended to be used for implied functions. For example, a query may have a function in a GROUP BY clause. It's desirable to include the function in the column set but not in the final result.Returns an absolute Variable object that can be used to reference this hidden column.
-
prepareSelectColumn
private void prepareSelectColumn(SelectColumn col, QueryContext context) throws DatabaseException
Prepares the given SelectColumn by fully qualifying the expression and allocating it correctly within this context.- Throws:
DatabaseException
-
prepare
void prepare(QueryContext context) throws DatabaseException
Resolves all variable objects in each column.- Throws:
DatabaseException
-
-