| java.lang.Object org.hsqldb.Expression
Expression | public class Expression (Code) | | |
Inner Class :static class Collector extends HashSet | |
Constructor Summary | |
| Expression(boolean b) | | Expression(Function f) | | Expression(NumberSequence sequence) | | Expression(Expression e) Copy Constructor. | | Expression(SubQuery sq) | | Expression(Expression[] valueList) | | Expression(int type, Expression e, Expression e2) | | Expression(Expression e, int dataType, int precision, int scale) | | Expression(Expression e, Expression e2, Character escape, boolean hasCollation) | | Expression(String schema, String table, String column) | | Expression(String table, String column, boolean isquoted) | | Expression(TableFilter filter, Column column) | | Expression(int datatype, Object o) | | Expression(int datatype, Object o, boolean isParam) |
Method Summary | |
void | bind(Object o) | boolean | canBeInAggregate() Check if this expression can be included as a result column in an
aggregated select statement. | boolean | canBeInGroupBy() Check if this expression can be included in a group by clause. | boolean | canBeInOrderBy() Check if this expression can be included in an order by clause. | boolean | checkResolved(boolean check) Final check for all expressions. | void | checkTables(HsqlArrayList filters) Resolve the table names for columns and throws if a column remains
unresolved. | void | collectAllColumnNames(HashSet columnNames) Collect all column names used in this expression or any of nested
expression. | boolean | collectColumnName(HashSet columnNames) Collect column name used in this expression. | void | collectInGroupByExpressions(HsqlArrayList colExps) Collects all expressions that must be in the GROUP BY clause, for a
grouped select statement. | public String | describe(Session session) | static boolean | equals(Object o1, Object o2) | static boolean | equals(Expression[] ae1, Expression[] ae2) | TableFilter | findTableFilter(TableFilter[] list) | Object | getAggregatedValue(Session session, Object currValue) | String | getAlias() | Expression | getArg() | Expression | getArg2() | String | getBaseColumnName() | int | getCaseWhenType(Session session) For CASE WHEN and its special cases section 9.3 of the SQL standard
on type aggregation should be implemented. | static Select | getCheckSelect(Session session, Table t, Expression e) Returns a Select object that can be used for checking the contents
of an existing table against the given CHECK search condition. | String | getColumnDDL() returns the complete name of the column represented by the expression
If an alias is known for the column's table, this alias will precede the
column name, except it's "SYSTEM_SUBQUERY". | String | getColumnName() | int | getColumnNr() | int | getColumnScale() | int | getColumnSize() | static String | getContextDDL(Expression expression) | String | getDDL() For use with CHECK constraints. | int | getDataType() | String | getDefinedAlias() | void | getEquiJoinColumns(TableFilter filter, boolean[] columns, Expression[] elist) | Expression | getExpressionForAlias(Expression[] columns, int length) | TableFilter | getFilter() | String | getFilterTableName() | Expression | getRightExpression() Gets the right leaf. | HsqlName | getTableHsqlName() | String | getTableName() | String | getTableSchemaName() | int | getType() | Object | getValue(Session session, int type) | Object | getValue(Session session) | String | getValueClassName() | boolean | isAggregate() | static boolean | isAggregate(int type) | boolean | isAliasQuoted() | static boolean | isCompare(int i) | boolean | isConditional() Checks for conditional expression. | boolean | isConstant() Check if this expression defines a constant value. | boolean | isDescending() | boolean | isFixedConditional() | boolean | isFixedConstant() | boolean | isParam() | boolean | isResolved() | boolean | isSelfAggregate() | boolean | isTypeEqual(Expression other) | void | replaceAliases(Expression[] columns, int length) | void | resolveTables(TableFilter f) | void | resolveTypeForIn(Session session) Parametric or fixed value lists plus queries are handled. | void | resolveTypeForLike(Session session) | void | resolveTypes(Session session) | void | setAlias(String s, boolean isquoted) | void | setColumnName(String newname, boolean isquoted) | void | setDataType(int type) | void | setDescending() | void | setDistinctAggregate(boolean distinct) | boolean | setForJoin(TableFilter tf, boolean outer) Marks all the expressions in the tree for a condition that is part
of a JOIN .. | void | setLeftExpression(Expression e) Sets the left leaf. | void | setLikeOptimised() Workaround for CHECK constraints. | void | setNull() | void | setRightExpression(Expression e) | void | setTableColumnAttributes(Expression e) | void | setTableColumnAttributes(Table t, int i) | void | setTableName(String newname) | void | setTrue() | public boolean | similarTo(Expression exp) Check if the given expression defines similar operation as this
expression. | static boolean | similarTo(Expression e1, Expression e2) | void | swapCondition() | Boolean | test(Session session) | boolean | testCondition(Session session) | Object | updateAggregatingValue(Session session, Object currValue) |
ASFORFROMBOTHLEADINGTRAILINGYEARMONTHDAYHOURMINUTESECONDTIMEZONE_HOURT_TIMEZONE_MINUTEDOW | final static int ASFORFROMBOTHLEADINGTRAILINGYEARMONTHDAYHOURMINUTESECONDTIMEZONE_HOURT_TIMEZONE_MINUTEDOW(Code) | | |
COUNTSUMMINMAXAVGEVERYSOMESTDDEV_POPSTDDEV_SAMPVAR_POPVAR_SAMP | final static int COUNTSUMMINMAXAVGEVERYSOMESTDDEV_POPSTDDEV_SAMPVAR_POPVAR_SAMP(Code) | | |
IFNULLCONVERTCASEWHENEXTRACTPOSITIONTRIMSUBSTRINGNULLIFCASECOALESCEALTERNATIVESEQUENCE | final static int IFNULLCONVERTCASEWHENEXTRACTPOSITIONTRIMSUBSTRINGNULLIFCASECOALESCEALTERNATIVESEQUENCE(Code) | | |
NEGATEADDSUBTRACTMULTIPLYDIVIDECONCAT | final static int NEGATEADDSUBTRACTMULTIPLYDIVIDECONCAT(Code) | | |
NOTEQUALBIGGER_EQUALBIGGERSMALLERSMALLER_EQUALNOT_EQUALLIKEANDORINEXISTSALLANYIS_NULL | final static int NOTEQUALBIGGER_EQUALBIGGERSMALLERSMALLER_EQUALNOT_EQUALLIKEANDORINEXISTSALLANYIS_NULL(Code) | | |
NO_NULLS | final static int NO_NULLS(Code) | | |
NULLABLE | final static int NULLABLE(Code) | | |
NULLABLE_UNKNOWN | final static int NULLABLE_UNKNOWN(Code) | | |
PARAM | final static int PARAM(Code) | | |
PARAM_IN | final public static int PARAM_IN(Code) | | |
PARAM_IN_OUT | final public static int PARAM_IN_OUT(Code) | | |
PARAM_OUT | final public static int PARAM_OUT(Code) | | |
PARAM_UNKNOWN | final static int PARAM_UNKNOWN(Code) | | |
PLUSOPENCLOSESELECTCOMMABETWEENCASTENDISWHENTHENELSEENDWHENDISTINCTVIEW | final static int PLUSOPENCLOSESELECTCOMMABETWEENCASTENDISWHENTHENELSEENDWHENDISTINCTVIEW(Code) | | |
SQL_EXTRACT_FIELD_NAMES | final static HashSet SQL_EXTRACT_FIELD_NAMES(Code) | | |
SQL_TRIM_SPECIFICATION | final static HashSet SQL_TRIM_SPECIFICATION(Code) | | |
VALUECOLUMNQUERYTRUEFALSEVALUELISTASTERISKFUNCTIONLIMITROW | final static int VALUECOLUMNQUERYTRUEFALSEVALUELISTASTERISKFUNCTIONLIMITROW(Code) | | |
isDistinctAggregate | boolean isDistinctAggregate(Code) | | |
isIdentity | boolean isIdentity(Code) | | |
isInJoin | boolean isInJoin(Code) | | |
isQueryCorrelated | boolean isQueryCorrelated(Code) | | |
isWritable | boolean isWritable(Code) | | |
joinedTableColumnIndex | int joinedTableColumnIndex(Code) | | |
nullability | int nullability(Code) | | |
Expression | Expression(boolean b)(Code) | | Creates a new boolean expression
Parameters: b - boolean constant |
Expression | Expression(Function f)(Code) | | Creates a new FUNCTION expression
Parameters: f - function |
Expression | Expression(NumberSequence sequence)(Code) | | Creates a new SEQUENCE expression
Parameters: sequence - number sequence |
Expression | Expression(Expression e)(Code) | | Copy Constructor. Used by TableFilter to move a condition to a filter.
Parameters: e - source expression |
Expression | Expression(SubQuery sq)(Code) | | Creates a new QUERY expression
Parameters: sq - subquery |
Expression | Expression(Expression[] valueList)(Code) | | Creates a new VALUELIST expression
Parameters: valueList - array of Expression |
Expression | Expression(int type, Expression e, Expression e2)(Code) | | Creates a new binary (or unary) operation expression
Parameters: type - operator type Parameters: e - operand 1 Parameters: e2 - operand 2 |
Expression | Expression(Expression e, int dataType, int precision, int scale)(Code) | | creates a CONVERT expression
|
Expression | Expression(Expression e, Expression e2, Character escape, boolean hasCollation)(Code) | | Creates a new LIKE expression
Parameters: e - operand 1 Parameters: e2 - operand 2 Parameters: escape - escape character |
Expression | Expression(String schema, String table, String column)(Code) | | Creates a new ASTERISK or COLUMN expression
Parameters: table - table Parameters: column - column |
Expression | Expression(String table, String column, boolean isquoted)(Code) | | Creates a new ASTERIX or possibly quoted COLUMN expression
Parameters: table - table Parameters: column - column name Parameters: isquoted - boolean |
Expression | Expression(int datatype, Object o)(Code) | | Creates a new VALUE expression
Parameters: datatype - data type Parameters: o - data |
Expression | Expression(int datatype, Object o, boolean isParam)(Code) | | Creates a new (possibly PARAM) VALUE expression
Parameters: datatype - initial datatype Parameters: o - initial value Parameters: isParam - true if this is to be a PARAM VALUE expression |
canBeInAggregate | boolean canBeInAggregate()(Code) | | Check if this expression can be included as a result column in an
aggregated select statement.
It can, if itself is an aggregate expression, or it results a constant
value.
boolean |
canBeInGroupBy | boolean canBeInGroupBy()(Code) | | Check if this expression can be included in a group by clause.
It can, if itself is a column expression, and it is not an aggregate
expression.
boolean |
canBeInOrderBy | boolean canBeInOrderBy()(Code) | | Check if this expression can be included in an order by clause.
It can, if itself is a column expression.
boolean |
checkResolved | boolean checkResolved(boolean check) throws HsqlException(Code) | | Final check for all expressions.
Parameters: check - boolean boolean throws: HsqlException - |
collectAllColumnNames | void collectAllColumnNames(HashSet columnNames)(Code) | | Collect all column names used in this expression or any of nested
expression.
Parameters: columnNames - set to be filled |
collectColumnName | boolean collectColumnName(HashSet columnNames)(Code) | | Collect column name used in this expression.
Parameters: columnNames - set to be filled true if a column name is used in this expression |
collectInGroupByExpressions | void collectInGroupByExpressions(HsqlArrayList colExps)(Code) | | Collects all expressions that must be in the GROUP BY clause, for a
grouped select statement.
Parameters: colExps - expression list |
getAggregatedValue | Object getAggregatedValue(Session session, Object currValue) throws HsqlException(Code) | | Get the result of a SetFunction or an ordinary value
Parameters: currValue - instance of set function or value Parameters: session - context object throws: HsqlException - |
getBaseColumnName | String getBaseColumnName()(Code) | | Returns the name of a column as string
column name |
getCaseWhenType | int getCaseWhenType(Session session) throws HsqlException(Code) | | For CASE WHEN and its special cases section 9.3 of the SQL standard
on type aggregation should be implemented.
|
getCheckSelect | static Select getCheckSelect(Session session, Table t, Expression e) throws HsqlException(Code) | | Returns a Select object that can be used for checking the contents
of an existing table against the given CHECK search condition.
Parameters: t - table Parameters: e - expression select object throws: HsqlException - |
getColumnDDL | String getColumnDDL() throws HsqlException(Code) | | returns the complete name of the column represented by the expression
If an alias is known for the column's table, this alias will precede the
column name, except it's "SYSTEM_SUBQUERY".
If no alias is known, the column's table will be asked for its
statementName, which then will precede the column name.
|
getColumnName | String getColumnName()(Code) | | Returns the name of a column as string
column name |
getColumnNr | int getColumnNr()(Code) | | Returns the column index in the table
column index |
getColumnScale | int getColumnScale()(Code) | | Returns the column scale
scale |
getColumnSize | int getColumnSize()(Code) | | Returns the column size
size |
getDDL | String getDDL() throws HsqlException(Code) | | For use with CHECK constraints. Under development.
Currently supports a subset of expressions and is suitable for CHECK
search conditions that refer only to the inserted/updated row.
For full DDL reporting of VIEW select queries and CHECK search
conditions, future improvements here are dependent upon improvements to
SELECT query parsing, so that it is performed in a number of passes.
An early pass should result in the query turned into an Expression tree
that contains the information in the original SQL without any
alterations, and with tables and columns all resolved. This Expression
can then be preserved for future use. Table and column names that
are not user-defined aliases should be kept as the HsqlName structures
so that table or column renaming is reflected in the precompiled
query.
DDL throws: HsqlException - |
getDataType | int getDataType()(Code) | | Returns the data type
type |
getDefinedAlias | String getDefinedAlias()(Code) | | Return the user defined alias or null if none
alias |
getEquiJoinColumns | void getEquiJoinColumns(TableFilter filter, boolean[] columns, Expression[] elist)(Code) | | set boolean flags and expressions for columns in a join
Parameters: filter - target table filter Parameters: columns - boolean array Parameters: elist - expression list |
getExpressionForAlias | Expression getExpressionForAlias(Expression[] columns, int length)(Code) | | return the expression for an aliases
|
getFilter | TableFilter getFilter()(Code) | | Returns the table filter for a COLUMN expression
table filter |
getFilterTableName | String getFilterTableName()(Code) | | Returns the table name for a column expression as a string
table name |
getRightExpression | Expression getRightExpression()(Code) | | Gets the right leaf.
expression |
getTableHsqlName | HsqlName getTableHsqlName()(Code) | | Returns the HsqlName of the table for a column expression
table name |
getTableName | String getTableName()(Code) | | Returns the table name for a column expression as a string
table name |
getType | int getType()(Code) | | Returns the type of expression
type |
getValue | Object getValue(Session session, int type) throws HsqlException(Code) | | Get the value in the given type in the given session context
Parameters: type - returned type Parameters: session - context value throws: HsqlException - |
isAggregate | boolean isAggregate()(Code) | | Is this (indirectly) an aggregate expression
boolean |
isAggregate | static boolean isAggregate(int type)(Code) | | |
isAliasQuoted | boolean isAliasQuoted()(Code) | | Is a column alias quoted
boolean |
isCompare | static boolean isCompare(int i)(Code) | | Is the argument expression type a comparison expression
Parameters: i - expresion type boolean |
isConditional | boolean isConditional()(Code) | | Checks for conditional expression.
boolean |
isConstant | boolean isConstant()(Code) | | Check if this expression defines a constant value.
It does, if it is a constant value expression, or all the argument
expressions define constant values.
boolean |
isDescending | boolean isDescending()(Code) | | Is an ORDER BY column expression DESC
boolean |
isFixedConditional | boolean isFixedConditional()(Code) | | |
isFixedConstant | boolean isFixedConstant()(Code) | | |
isParam | boolean isParam()(Code) | | |
isResolved | boolean isResolved()(Code) | | Has this expression been resolved
boolean |
isSelfAggregate | boolean isSelfAggregate()(Code) | | Is this directly an aggregate expression
boolean |
resolveTypeForIn | void resolveTypeForIn(Session session) throws HsqlException(Code) | | Parametric or fixed value lists plus queries are handled.
Empty lists are not allowed.
Parametric predicand is resolved against the value list and vice versa.
|
setAlias | void setAlias(String s, boolean isquoted)(Code) | | Set the column alias and whether the name is quoted
Parameters: s - alias Parameters: isquoted - boolean |
setColumnName | void setColumnName(String newname, boolean isquoted)(Code) | | Change the column name
Parameters: newname - name Parameters: isquoted - quoted |
setDataType | void setDataType(int type)(Code) | | Set the data type
Parameters: type - data type |
setDescending | void setDescending()(Code) | | Set an ORDER BY column expression DESC
|
setDistinctAggregate | void setDistinctAggregate(boolean distinct)(Code) | | Set this as a set function with / without DISTINCT
Parameters: distinct - is distinct |
setForJoin | boolean setForJoin(TableFilter tf, boolean outer)(Code) | | Marks all the expressions in the tree for a condition that is part
of a JOIN .. ON ....
For LEFT OUTER joins, also tests the expression tree for the join
condition to ensure only permitted expression types are there.
If we want to exapand the expressions to include arithmetic operations
or functions ...
(fredt@users)
Parameters: tf - table filter Parameters: outer - boolean boolean |
setLeftExpression | void setLeftExpression(Expression e)(Code) | | Sets the left leaf.
Parameters: e - expression |
setLikeOptimised | void setLikeOptimised() throws HsqlException(Code) | | Workaround for CHECK constraints. We don't want optimisation so we
flag all LIKE expressions as already optimised.
throws: HsqlException - |
setTableColumnAttributes | void setTableColumnAttributes(Table t, int i)(Code) | | |
setTableName | void setTableName(String newname)(Code) | | Change the table name
Parameters: newname - table name for column expression |
setTrue | void setTrue()(Code) | | When an Expression is assigned to a TableFilter, a copy is made for use
there and the original is set to Expression.TRUE
|
similarTo | public boolean similarTo(Expression exp)(Code) | | Check if the given expression defines similar operation as this
expression. This method is used for ensuring an expression in
the ORDER BY clause has a matching column in the SELECT list. This check
is necessary with a SELECT DISTINCT query.
In the future we may perform the test when evaluating the search
condition to get a more accurate match.
Parameters: exp - expression boolean |
updateAggregatingValue | Object updateAggregatingValue(Session session, Object currValue) throws HsqlException(Code) | | Instantiate the SetFunction or recurse, returning the result
Parameters: currValue - setFunction Parameters: session - context a normal value or SetFunction instance throws: HsqlException - |
|
|