gudusoft.gsqlparser.nodes
Class TExpression

java.lang.Object
  extended by gudusoft.gsqlparser.nodes.TParseTreeNode
      extended by gudusoft.gsqlparser.nodes.TExpression
All Implemented Interfaces:
Visitable

public class TExpression
extends TParseTreeNode

An expression is a combination of one or more values, operators, and SQL functions that evaluates to a value. There are lots of types of expression in this SQL parser, expressionType is used to distinguish these types.

expressionTypeOperand
absoluteValue TExpression getRightOperand()
arrayConstructor TSelectSqlStatement getSubQuery()
arrayConstructor TExpressionList getExprList()
arrayConstructor NULL
arrayaccess N/A
ASSIGNMENT TExpression getLeftOperand(), TExpression getRightOperand()
at_local TExpression getLeftOperand()
at_time_zone TExpression getLeftOperand(), TExpression getRightOperand()
between_conditions TExpression getBetweenOperand(),TExpression getLeftOperand(), TExpression getRightOperand()
BITWISE_AND TExpression getLeftOperand(), TExpression getRightOperand()
BITWISE_EXCLUSIVE_OR TExpression getLeftOperand(), TExpression getRightOperand()
BITWISE_NOT TExpression getRightOperand()
BITWISE_OR TExpression getLeftOperand(), TExpression getRightOperand()
BITWISE_SHIFT_LEFT TExpression getLeftOperand(), TExpression getRightOperand()
BITWISE_SHIFT_RIGHT TExpression getLeftOperand(), TExpression getRightOperand()
BITWISE_XOR TExpression getLeftOperand(), TExpression getRightOperand()
caseExprOperator TCaseExpression getCaseExpression()
COLLATE TExpression getLeftOperand(), TExpression getRightOperand()
compoundAssignment TExpression getLeftOperand(), TExpression getRightOperand()
compoundParenthesis TExpression getLeftOperand()
compoundPrior TExpression getRightOperand()
compoundUnaryBitwiseNot TExpression getRightOperand()
compoundUnaryMinus TExpression getRightOperand()
compoundUnaryPlus TExpression getRightOperand()
CONCATENATE TExpression getLeftOperand(), TExpression getRightOperand()
connect_by_root TExpression getRightOperand()
cubeRoot TExpression getRightOperand()
cursorExprOperator TSelectSqlStatement getSubQuery()
datetimeExprOperator N/A
day_to_second TExpression getLeftOperand()
DIVIDE TExpression getLeftOperand(), TExpression getRightOperand()
exists_condition TSelectSqlStatement getSubQuery()
EXPONENTIATE TExpression getLeftOperand(), TExpression getRightOperand()
expr_list TExpressionList getExprList()
factorial TExpression getLeftOperand()
factorialPrefix TExpression getRightOperand()
fieldSelection TObjectName getFieldName()
floating_point_conditions TExpression getLeftOperand()
funcationCallOperator TFunctionCall getFunctionCall()
group_comparison_conditions TExpression getLeftOperand(), TInExpr getInExpr()
in_conditions TExpression getLeftOperand(),TExpression getRightOperand()
in_expr TInExpr getInExpr()
intervalExprOperator N/A
interval_expression TIntervalExpression getIntervalExpr()
is_distinct_from TExpression getLeftOperand(), TExpression getRightOperand()
is_document TExpression getLeftOperand()
isoftype_condition TExpression getLeftOperand()
left_shift TExpression getLeftOperand(), TExpression getRightOperand()
LEFTJOIN_OP TExpression getLeftOperand(), TExpression getRightOperand()
logical_conditions_and TExpression getLeftOperand(), TExpression getRightOperand()
logical_conditions_is N/A
logical_conditions_not TExpression getRightOperand()
logical_conditions_or TExpression getLeftOperand(), TExpression getRightOperand()
member_of TExpression getLeftOperand(), TExpression getRightOperand()
MINUS TExpression getLeftOperand(), TExpression getRightOperand()
modelExprOperator N/A
MODULO TExpression getLeftOperand(), TExpression getRightOperand()
multisetExprOperator TSelectSqlStatement getSubQuery()
mysql_binary_operator TExpression getRightOperand()
new_structured_type TFunctionCall getFunctionCall()
new_variant_type TNewVariantTypeArgumentList getNewVariantTypeArgumentList()
null_conditions TExpression getLeftOperand()
objectaccessExprOperator N/A
pattern_matching_conditions TExpression getLeftOperand(), TExpression getRightOperand()
pattern_matching_conditions TExpression getLeftOperand(), TExpression getRightOperand(),TExpression getLikeEscapeOperand()
patternMatchingExprOperator N/A
period_ldiff TExpression getLeftOperand(), TExpression getRightOperand()
period_p_intersect TExpression getLeftOperand(), TExpression getRightOperand()
period_p_normalize TExpression getLeftOperand(), TExpression getRightOperand()
period_rdiff TExpression getLeftOperand(), TExpression getRightOperand()
placeholderExprOperator N/A
PLUS TExpression getLeftOperand(), TExpression getRightOperand()
POWER N/A
RANGE N/A
ref_arrow TExpression getLeftOperand(), TExpression getRightOperand()
right_shift TExpression getLeftOperand(), TExpression getRightOperand()
RIGHTJOIN_OP TExpression getLeftOperand(), TExpression getRightOperand()
rowConstructor TExpressionList getExprList()
rowConstructor NULL
SCOPE_RESOLUTION N/A
simple_comparison_conditions TExpression getLeftOperand(), TExpression getRightOperand()
simpleConstant TConstant getConstantOperand()
simpleObjectname TObjectName getObjectOperand()
simpleSourcetoken TSourceToken getSourcetokenOperand()
sqlserver_proprietary_column_alias TExpression getLeftOperand(), TExpression getRightOperand()
squareRoot TExpression getRightOperand()
subqueryExprOperator TSelectSqlStatement getSubQuery()
TIMES TExpression getLeftOperand(), TExpression getRightOperand()
true_false_unknown TExpression getLeftOperand()
typecast TExpression getLeftOperand()
typeconstructorExprOperator N/A
UnknownOperator TExpression getLeftOperand(), TExpression getRightOperand()
UnknownUnaryOperator TExpression getRightOperand()
UnknownUnaryOperatorRight TExpression getLeftOperand()
until_changed TExpression getLeftOperand()
year_to_month TExpression getLeftOperand()


Field Summary
static int absoluteValue
          Postgresql absolute value
static int arrayaccess
           
static int arrayConstructor
          An array constructor is an expression that builds an array value using values for its member elements.
static int ASSIGNMENT
          Used in set clause of update statement.
static int at_local
          ORACLE,teradata date time expression, at local.
static int at_time_zone
          ORACLE,teradata date time expression, at time zone.
static int between_conditions
          A BETWEEN condition determines whether the value of one expression is in an interval defined by two other expressions.
static int BITWISE_AND
          SQL SERVER, postgresql
static int BITWISE_EXCLUSIVE_OR
          SQL SERVER
static int BITWISE_NOT
          Postgresql bitwise not
static int BITWISE_OR
          SQL SERVER, postgresql
static int BITWISE_SHIFT_LEFT
          Postgresql bitwise shit left
static int BITWISE_SHIFT_RIGHT
          Postgresql bitwise shit right
static int BITWISE_XOR
          MySQL, postgresql
static int caseExprOperator
          CASE expressions let you use IF ...
static int COLLATE
          sql server, Is a clause that can be applied to a database definition or a column definition to define the collation, or to a character string expression to apply a collation cast.
static int compoundAssignment
          sql server 2008 +=,-=,*=,/=,%=
static int compoundParenthesis
          expression with parenthesis, expr can be get via getLeftOperand() which is type of TExpression.
static int compoundPrior
          Oracle prior expression, syntax: PRIOR expr value can be accessed via getRightOperand() which is type of TExpression
static int compoundUnaryBitwiseNot
          sql server
static int compoundUnaryMinus
          unary minus expression,
static int compoundUnaryPlus
          unary plus expression,
static int CONCATENATE
          Links two string operands to form a string expression.
static int connect_by_root
          oracle unary operator connect_by_root is only valid in hierarchical queries
static int cubeRoot
          Postgresql cube root
static int cursorExprOperator
          A CURSOR expression returns a nested cursor.
static int datetimeExprOperator
          datetime expression
static int day_to_second
          ORACLE date time expression, day to second.
static int DIVIDE
          syntax: expr / expr
static int dummyOperator
           
static int exists_condition
          An EXISTS condition tests for existence of rows in a subquery.
static int EXPONENTIATE
          teradata ** , Postgresql ^
static int expr_list
          row descriptor, values can be get via getExprList()
static int factorial
          Postgresql factorial:
static int factorialPrefix
          Postgresql factorial (prefix operator):
static int fieldSelection
          If an expression yields a value of a composite type (row type), then a specific field of the row can be extracted by writing
static int floating_point_conditions
          The ORACLE floating-point conditions let you determine whether an expression is infinite or is the undefined result of an operation (is not a number or NaN).
static int funcationCallOperator
          funcation expression,
static int group_comparison_conditions
          Comparison conditions compare one expression with another.
static int in_conditions
          An in_condition is a membership condition.
static int in_expr
          IN expr, values can be get via getInExpr()
static int interval_expression
          Teradata interval expression:
static int intervalExprOperator
          interval expression
static int is_distinct_from
          Postgresql,
static int is_document
          Postgresql, is document condition
static int isoftype_condition
          expr can be accessed via getLeftOperand()
static int left_shift
          MySQL left shift
static int LEFTJOIN_OP
          sql server, LEFTJOIN_OP *=
static int logical_conditions_and
          A logical condition combines the results of two component conditions to produce a single result based on them or to invert the result of a single condition.
static int logical_conditions_is
          Mdx is logical condition
static int logical_conditions_not
          A logical condition combines the results of two component conditions to produce a single result based on them or to invert the result of a single condition.
static int logical_conditions_or
          A logical condition combines the results of two component conditions to produce a single result based on them or to invert the result of a single condition.
static int logical_conditions_xor
          A logical condition combines the results of two component conditions to produce a single result based on them or to invert the result of a single condition.
static int member_of
          ORACLE
static int MINUS
          syntax: expr - expr
static int modelExprOperator
          model expression, not implemented yet
static int MODULO
          SQL SERVER,TERADATE(mod)
static int multisetExprOperator
          Oracle MULTISET operator
static int mysql_binary_operator
          MySQL binary operator, select binary 'a' = 'A'
static int new_structured_type
          teradata Constructs a new instance of a structured type and initializes it using the specified constructor method or function.
static int new_variant_type
          Teradata Constructs a new instance of a dynamic or VARIANT_TYPE UDT and defines the run time composition of the UDT.
static int null_conditions
          A NULL condition tests for nulls.
static int objectaccessExprOperator
          object access expression, some of those was represented by simpleObjectname expression.
static int pattern_matching_conditions
          The pattern-matching conditions compare character data.
static int patternMatchingExprOperator
          pattern matching conditon support like only, regexp_like was treat as a function
static int period_ldiff
          Teradata period expression: ldiff
static int period_p_intersect
          Teradata period expression: p_intersect
static int period_p_normalize
          Teradata period expression: p_normalize
static int period_rdiff
          Teradata period expression: rdiff
static int placeholderExprOperator
          place holder expression
static int PLUS
          syntax: expr + expr
static int POWER
          mdx power operator ^
static int RANGE
          Mdx range operator :
static int ref_arrow
          plsql RAISE_APPLICATION_ERROR (num=> -20107, msg=> 'Duplicate customer or order ID');
static int right_shift
          MySQL rigth shift
static int RIGHTJOIN_OP
          sql server, RIGHTJOIN_OP =*
static int rowConstructor
          A row constructor is an expression that builds a row value (also called a composite value) using values for its member fields.
static int SCOPE_RESOLUTION
          SQL SERVER
static int simple_comparison_conditions
          Comparison conditions compare one expression with another.
static int simpleConstant
          specifies a constant, value can be get via getConstantOperand()
static int simpleObjectname
          specifies a column, pseudocolumn, sequence number, value can be get via getObjectOperand() which is type of TObjectName.
static int simpleSourcetoken
          specifies a null, value can be get via getSourcetokenOperand() which is type of TSourceToken.
static int sqlserver_proprietary_column_alias
          SQL SERVER Proprietary syntax, set alias of a column in select list, column expr in rightOperand.
static int squareRoot
          Postgresql square root
static int subqueryExprOperator
          A scalar subquery expression is a subquery that returns exactly one column value from one row.
static int TIMES
          syntax: expr * expr
static int true_false_unknown
          Postgresql
static int typecast
          plsql
static int typeconstructorExprOperator
          type constructor expression,
static int unknown
          unknow expression type
static int UnknownOperator
          This UnknownOperator means this expression was not recognized by SQL parser yet.
static int UnknownUnaryOperator
          This UnknownLeftUnaryOperator means this expression was not recognized by SQL parser yet.
static int UnknownUnaryOperatorRight
          This UnknownLeftUnaryOperator means this expression was not recognized by SQL parser yet.
static int until_changed
          Teradata until changed condition
static int year_to_month
          ORACLE date time expression, year to month.
 
Constructor Summary
TExpression()
           
 
Method Summary
 void accept(TParseTreeVisitor v)
           
 void addANDCondition(java.lang.String condition)
          if original expr is f > 1, and call addANDCondition("f2 > 2") expression will be: f > 1 and f2 > 2
 void addORCondition(java.lang.String condition)
          if original expr is f > 1, and call addORCondition("f2 > 2") expression will be: f > 1 or f2 > 2
 void doParse(TCustomSqlStatement psql, ESqlClause plocation)
          analyze this node
 TArrayAccess getArrayAccess()
           
 TExpression getBetweenOperand()
           
 TCaseExpression getCaseExpression()
           
 TSourceToken getComparisonOperator()
           
 TConstant getConstantOperand()
           
 int getExpressionType()
           
 TExpressionList getExprList()
           
 TObjectName getFieldName()
          valid when getExpressionType() is fieldSelection
 TFunctionCall getFunctionCall()
           
 TIndirection getIndirection()
           
 TInExpr getInExpr()
           
 TIntervalExpression getIntervalExpr()
           
 TExpression getLeftOperand()
           
 TExpression getLikeEscapeOperand()
           
 TNewVariantTypeArgumentList getNewVariantTypeArgumentList()
           
 TObjectName getObjectOperand()
           
 TSourceToken getOperatorToken()
          Operator token used in expression such as +,-,*,/ and etc
 TOutputFormatPhraseList getOutputFormatPhraseList()
          Teradata:
 TExpression getParentExpr()
           
 TSourceToken getQuantifier()
          one of the following quantifier keywords: SOME, ANY, ALL
 TExpression getRightOperand()
           
 TSourceToken getSourcetokenOperand()
           
 TSelectSqlStatement getSubQuery()
           
 TTypeName getTypeName()
           
 java.lang.Object getVal()
          value of this expression, valid only after evaluate this expression.
 void inOrderTraverse(IExpressionVisitor ev)
           
 boolean isLeaf()
           
 boolean isLeafExpr(TParseTreeNode pnode)
           
 boolean isNotModifier()
          return true for expression like this: NOT IS NULL, NOT LIKE , NOT BETWEEN AND and return false for expression like this: IS NULL, LIKE , BETWEEN AND
 boolean isOracleOuterJoin()
           
 boolean isSubscripts()
          If an expression yields a value of an array type, then a specific element of the array value can be extracted by writing
 boolean isVisitSubTree()
           
 void postOrderTraverse(IExpressionVisitor ev)
           
 void preOrderTraverse(IExpressionVisitor ev)
           
 void remove()
          remove this expression from it's parent expr.
 void setArrayAccess(TArrayAccess arrayAccess)
           
 void setBetweenOperand(TExpression betweenOperand)
           
 void setCaseExpression(TCaseExpression caseExpression)
           
 void setComparisonOperator(TSourceToken comparisonOperator)
           
 void setConstantOperand(TConstant constantOperand)
           
 void setDatetimeExpression(TDatetimeExpression datetimeExpression)
           
 void setExpressionType(int expressionType)
           
 void setExprList(TExpressionList exprList)
           
 void setFunctionCall(TFunctionCall functionCall)
           
 void setIndirection(TIndirection indirection)
           
 void setInExpr(TInExpr inExpr)
           
 void setIntervalExpr(TIntervalExpression intervalExpr)
           
 void setIntervalExpression(TIntervalExpression intervalExpression)
           
 void setLeftOperand(TExpression leftOperand)
           
 void setLikeEscapeOperand(TExpression likeEscapeOperand)
           
 void setNewVariantTypeArgumentList(TNewVariantTypeArgumentList newVariantTypeArgumentList)
           
 void setObjectOperand(TObjectName objectOperand)
           
 void setOperatorToken(TSourceToken operatorToken)
           
 void setOracleOuterJoin(boolean oracleOuterJoin)
           
 void setOutputFormatPhraseList(TOutputFormatPhraseList outputFormatPhraseList)
           
 void setParentExpr(TExpression parentExpr)
           
 void setQuantifier(TSourceToken quantifier)
           
 void setRightOperand(TExpression rightOperand)
           
 void setSourcetokenOperand(TSourceToken sourcetokenOperand)
           
 void setSubQuery(TSelectSqlStatement subQuery)
           
 void setSubQueryInStmt(boolean subQueryInStmt)
           
 void setSubQueryNode(TSelectSqlNode subQueryNode)
           
 void setTypeName(TTypeName typeName)
           
 void setVal(java.lang.Object val)
           
 void setVisitSubTree(boolean visitSubTree)
           
 
Methods inherited from class gudusoft.gsqlparser.nodes.TParseTreeNode
addAllMyTokensToTokenList, getColumnNo, getDummyTag, getEndToken, getGsqlparser, getLineNo, getNodeType, getStartToken, init, init, init, init, init, init, setDummyTag, setEndToken, setEndToken, setGsqlparser, setNodeType, setStartToken, setStartToken, setString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

unknown

public static final int unknown
unknow expression type

See Also:
Constant Field Values

PLUS

public static final int PLUS
syntax: expr + expr

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

MINUS

public static final int MINUS
syntax: expr - expr

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

TIMES

public static final int TIMES
syntax: expr * expr

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

DIVIDE

public static final int DIVIDE
syntax: expr / expr

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

CONCATENATE

public static final int CONCATENATE
Links two string operands to form a string expression.

syntax: expr || expr,

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

MODULO

public static final int MODULO
SQL SERVER,TERADATE(mod)

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

ASSIGNMENT

public static final int ASSIGNMENT
Used in set clause of update statement.

Or, assign argument in postgresql function argument like this:

param_name ASSIGN_SIGN basic_expr

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

BITWISE_AND

public static final int BITWISE_AND
SQL SERVER, postgresql

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

BITWISE_OR

public static final int BITWISE_OR
SQL SERVER, postgresql

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

BITWISE_XOR

public static final int BITWISE_XOR
MySQL, postgresql

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

BITWISE_EXCLUSIVE_OR

public static final int BITWISE_EXCLUSIVE_OR
SQL SERVER

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

SCOPE_RESOLUTION

public static final int SCOPE_RESOLUTION
SQL SERVER

The scope resolution operator :: provides access to static members of a compound data type, SELECT @hid = hierarchyid::GetRoot();

Not implemented yet,

See Also:
Constant Field Values

EXPONENTIATE

public static final int EXPONENTIATE
teradata ** , Postgresql ^

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

compoundAssignment

public static final int compoundAssignment
sql server 2008 +=,-=,*=,/=,%=

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

simpleObjectname

public static final int simpleObjectname
specifies a column, pseudocolumn, sequence number, value can be get via getObjectOperand() which is type of TObjectName.

See Also:
Constant Field Values

simpleConstant

public static final int simpleConstant
specifies a constant, value can be get via getConstantOperand()

See Also:
Constant Field Values

simpleSourcetoken

public static final int simpleSourcetoken
specifies a null, value can be get via getSourcetokenOperand() which is type of TSourceToken.

See Also:
Constant Field Values

compoundParenthesis

public static final int compoundParenthesis
expression with parenthesis, expr can be get via getLeftOperand() which is type of TExpression.

See Also:
Constant Field Values

compoundUnaryPlus

public static final int compoundUnaryPlus
unary plus expression,

syntax: + expression

expr can be accessed via getRightOperand()

See Also:
Constant Field Values

compoundUnaryMinus

public static final int compoundUnaryMinus
unary minus expression,

syntax: - expression

expr can be accessed via getRightOperand()

See Also:
Constant Field Values

compoundPrior

public static final int compoundPrior
Oracle prior expression, syntax: PRIOR expr value can be accessed via getRightOperand() which is type of TExpression

See Also:
Constant Field Values

caseExprOperator

public static final int caseExprOperator
CASE expressions let you use IF ... THEN ... ELSE logic in SQL statements without having to invoke procedures. value can be accessed via getCaseExpression() which is type of TCaseExpression.

See Also:
Constant Field Values

cursorExprOperator

public static final int cursorExprOperator
A CURSOR expression returns a nested cursor.

syntax: CURSOR(subquery ),

subquery can be accessed via getSubQuery() which is type of TSelectSqlStatement.

See Also:
Constant Field Values

funcationCallOperator

public static final int funcationCallOperator
funcation expression,

value can be get via getFunctionCall()

See Also:
Constant Field Values

datetimeExprOperator

public static final int datetimeExprOperator
datetime expression

N/A

See Also:
Constant Field Values

intervalExprOperator

public static final int intervalExprOperator
interval expression

N/A

See Also:
Constant Field Values

modelExprOperator

public static final int modelExprOperator
model expression, not implemented yet

N/A

See Also:
Constant Field Values

subqueryExprOperator

public static final int subqueryExprOperator
A scalar subquery expression is a subquery that returns exactly one column value from one row.
value can be get via getSubQuery() which is type of TSelectSqlStatement.

See Also:
Constant Field Values

typeconstructorExprOperator

public static final int typeconstructorExprOperator
type constructor expression,

not implemented yet

See Also:
Constant Field Values

objectaccessExprOperator

public static final int objectaccessExprOperator
object access expression, some of those was represented by simpleObjectname expression.

N/A

See Also:
Constant Field Values

patternMatchingExprOperator

public static final int patternMatchingExprOperator
pattern matching conditon support like only, regexp_like was treat as a function

N/A

See Also:
Constant Field Values

placeholderExprOperator

public static final int placeholderExprOperator
place holder expression

See Also:
Constant Field Values

in_expr

public static final int in_expr
IN expr, values can be get via getInExpr()

See Also:
Constant Field Values

expr_list

public static final int expr_list
row descriptor, values can be get via getExprList()

See Also:
Constant Field Values

dummyOperator

public static final int dummyOperator
See Also:
Constant Field Values

simple_comparison_conditions

public static final int simple_comparison_conditions
Comparison conditions compare one expression with another. The result of such a comparison can be TRUE, FALSE, or NULL. A simple comparison condition specifies a comparison with expressions or subquery results.

Syntax: expr EQUAL|NOT_EQUAL|LESS_THAN|GRREAT_THAN|LESS_EQUAL_THAN|GREATE_EQUAL_THAN expr, or, (expr_list) EQUAL|NOT_EQUAL (subquery)

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

group_comparison_conditions

public static final int group_comparison_conditions
Comparison conditions compare one expression with another. The result of such a comparison can be TRUE, FALSE, or NULL.

A group comparison condition specifies a comparison with any or all members in a list or subquery.

Syntax: expr EQUAL|NOT_EQUAL|LESS_THAN|GRREAT_THAN|LESS_EQUAL_THAN|GREATE_EQUAL_THAN ANY|SOME|ALL (expr_list|subquery), or, (expr_list) EQUAL|NOT_EQUAL ANY|SOME|ALL (expr_list|subquery)

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

in_conditions

public static final int in_conditions
An in_condition is a membership condition. It tests a value for membership in a list of values or subquery.

Syntax: (expr|expr_list) IN|NOT IN (expr_list|subquery).

expr can be accessed via getLeftOperand() and getRightOperand()

Use getOperatorToken() to distinguish in or not in.

See Also:
Constant Field Values

floating_point_conditions

public static final int floating_point_conditions
The ORACLE floating-point conditions let you determine whether an expression is infinite or is the undefined result of an operation (is not a number or NaN).

Syntax: expr IS|IS NOT (NAM|INFINITE).

Value can be get via getLeftOperand()

See Also:
Constant Field Values

pattern_matching_conditions

public static final int pattern_matching_conditions
The pattern-matching conditions compare character data.

The LIKE conditions specify a test involving pattern matching.

Syntax: expr1 LIKE|NOT_LIKE expr1 [ESCAPE expr3],

expr1 can be get via getLeftOperand(),

expr2 can be get via getRightOperand(),

expr3 can be get via getLikeEscapeOperand(),

Use getOperatorToken() to distinguish is like or is not like

See Also:
Constant Field Values

null_conditions

public static final int null_conditions
A NULL condition tests for nulls. This is the only condition that you should use to test for nulls.

Syntax: expr IS [NOT] null

expr can be accessed via getLeftOperand()

Use getOperatorToken() to distinguish is null or is not null

See Also:
Constant Field Values

between_conditions

public static final int between_conditions
A BETWEEN condition determines whether the value of one expression is in an interval defined by two other expressions.

Syntax: expr1 [NOT] BETWEEN expr2 AND expr3

expr1 can be get via betweenOperand,

expr2 can be get via getLeftOperand(), and expr3 can be get via getRightOperand(),

Use getOperatorToken() to distinguish is between or is not between

See Also:
Constant Field Values

exists_condition

public static final int exists_condition
An EXISTS condition tests for existence of rows in a subquery.

Syntax: EXISTS (subquery).

value of subquery can be get via getSubQuery()

See Also:
Constant Field Values

isoftype_condition

public static final int isoftype_condition

expr can be accessed via getLeftOperand()

See Also:
Constant Field Values

logical_conditions_and

public static final int logical_conditions_and
A logical condition combines the results of two component conditions to produce a single result based on them or to invert the result of a single condition.

Syntax: expr AND expr.

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

logical_conditions_or

public static final int logical_conditions_or
A logical condition combines the results of two component conditions to produce a single result based on them or to invert the result of a single condition.

Syntax: expr OR expr.

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

logical_conditions_xor

public static final int logical_conditions_xor
A logical condition combines the results of two component conditions to produce a single result based on them or to invert the result of a single condition.

Syntax: expr XOR expr.

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

logical_conditions_not

public static final int logical_conditions_not
A logical condition combines the results of two component conditions to produce a single result based on them or to invert the result of a single condition.

Syntax: NOT expr.

value can be get via rightOperand,

See Also:
Constant Field Values

logical_conditions_is

public static final int logical_conditions_is
Mdx is logical condition

See Also:
Constant Field Values

RANGE

public static final int RANGE
Mdx range operator :

See Also:
Constant Field Values

POWER

public static final int POWER
mdx power operator ^

See Also:
Constant Field Values

at_time_zone

public static final int at_time_zone
ORACLE,teradata date time expression, at time zone.

Syntax: expr1 AT TIME ZONE expr2

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

at_local

public static final int at_local
ORACLE,teradata date time expression, at local.

Syntax: expr AT LOCAL.

expr can be accessed via getLeftOperand()

See Also:
Constant Field Values

day_to_second

public static final int day_to_second
ORACLE date time expression, day to second.

Syntax: expr DAY [( integer )] TO SECOND [( integer )].

expr cam be get via getLeftOperand().

The type of this operand is TExpression.

See Also:
Constant Field Values

year_to_month

public static final int year_to_month
ORACLE date time expression, year to month.

Syntax: expr YEAR [( integer )] TO MONTH.

expr can be accessed via getLeftOperand()

See Also:
Constant Field Values

interval_expression

public static final int interval_expression
Teradata interval expression:

( date_time_expression date_time_term ) start TO end

getIntervalExpr()

See Also:
Constant Field Values

new_structured_type

public static final int new_structured_type
teradata Constructs a new instance of a structured type and initializes it using the specified constructor method or function.

object reference getFunctionCall()

See Also:
Constant Field Values

new_variant_type

public static final int new_variant_type
Teradata Constructs a new instance of a dynamic or VARIANT_TYPE UDT and defines the run time composition of the UDT. object reference getNewVariantTypeArgumentList()

See Also:
Constant Field Values

period_ldiff

public static final int period_ldiff
Teradata period expression: ldiff

expression can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

period_rdiff

public static final int period_rdiff
Teradata period expression: rdiff

expression can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

period_p_intersect

public static final int period_p_intersect
Teradata period expression: p_intersect

expression can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

period_p_normalize

public static final int period_p_normalize
Teradata period expression: p_normalize

expression can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

until_changed

public static final int until_changed
Teradata until changed condition

syntax: END(period_value_expression) IS[NOT] UNTIL_CHANGED

ending bound of a Period value expression can be accessed via getLeftOperand()

See Also:
Constant Field Values

is_document

public static final int is_document
Postgresql, is document condition

expr is [not] document

expr was set in leftOperand.

getOperatorToken() can be used to check whether NOT keyword was used or not.

See Also:
Constant Field Values

is_distinct_from

public static final int is_distinct_from
Postgresql,

expr is [not] distinct from expr

expr can be accessed via getLeftOperand() and getRightOperand()

getOperatorToken() can be used to check whether NOT keyword was used or not.

See Also:
Constant Field Values

true_false_unknown

public static final int true_false_unknown
Postgresql

true, false, unknown condition

expr is [not] true

expr is [not] false

expr is [not] unknown

expr can be accessed via getLeftOperand()

getOperatorToken() can be used to check whether NOT keyword was used or not.

See Also:
Constant Field Values

compoundUnaryBitwiseNot

public static final int compoundUnaryBitwiseNot
sql server

expr can be accessed via getRightOperand()

See Also:
Constant Field Values

COLLATE

public static final int COLLATE
sql server, Is a clause that can be applied to a database definition or a column definition to define the collation, or to a character string expression to apply a collation cast. postgresql

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

LEFTJOIN_OP

public static final int LEFTJOIN_OP
sql server, LEFTJOIN_OP *=

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

RIGHTJOIN_OP

public static final int RIGHTJOIN_OP
sql server, RIGHTJOIN_OP =*

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

ref_arrow

public static final int ref_arrow
plsql RAISE_APPLICATION_ERROR (num=> -20107, msg=> 'Duplicate customer or order ID');

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

typecast

public static final int typecast
plsql

expr can be accessed via getLeftOperand()

See Also:
Constant Field Values

arrayaccess

public static final int arrayaccess
See Also:
Constant Field Values

connect_by_root

public static final int connect_by_root
oracle unary operator connect_by_root is only valid in hierarchical queries

expr can be accessed via getRightOperand()

See Also:
Constant Field Values

sqlserver_proprietary_column_alias

public static final int sqlserver_proprietary_column_alias
SQL SERVER Proprietary syntax, set alias of a column in select list, column expr in rightOperand.

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

mysql_binary_operator

public static final int mysql_binary_operator
MySQL binary operator, select binary 'a' = 'A'

syntax: binary expr

expr can be accessed via getRightOperand()

See Also:
Constant Field Values

left_shift

public static final int left_shift
MySQL left shift

Syntax: expr << expr.

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

right_shift

public static final int right_shift
MySQL rigth shift

Syntax: expr >> expr.

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

multisetExprOperator

public static final int multisetExprOperator
Oracle MULTISET operator

Syntax MULTISET (subquery)

subquery can be get via getSubQuery()

See Also:
Constant Field Values

fieldSelection

public static final int fieldSelection
If an expression yields a value of a composite type (row type), then a specific field of the row can be extracted by writing

expression.fieldname

In general the row expression must be parenthesized, but the parentheses can be omitted

when the expression to be selected from is just a table reference or positional parameter.

For example:

mytable.mycolumn

$1.somecolumn

(rowfunction(a,b)).col3

(Thus, a qualified column reference is actually just a special case of the field selection syntax.) An important special case is extracting a field from a table column that is of a composite type:

(compositecol).somefield

(mytable.compositecol).somefield

The parentheses are required here to show that compositecol is a column name not a table name,

or that mytable is a table name not a schema name in the second case.

n a select list, you can ask for all fields of a composite value by writing .*:

(compositecol).*

When expression in following syntax, it will be marked as fieldSelection, and check getFieldName()

(rowfunction(a,b)).col3

(compositecol).somefield

(mytable.compositecol).somefield

(compositecol).*

Otherwise, it will be marked as simpleObjectname:

mytable.mycolumn

$1.somecolumn

See Also:
Constant Field Values

arrayConstructor

public static final int arrayConstructor
An array constructor is an expression that builds an array value using values for its member elements.

like this: ARRAY[1,2,3+4]

array element values can be accessed via getExprList(),

or getExprList() can be null when it is: array[]

It is also possible to construct an array from the results of a subquery like this:

SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%');

thus, subquery can be access via getSubQuery()

See Also:
Constant Field Values

rowConstructor

public static final int rowConstructor
A row constructor is an expression that builds a row value (also called a composite value) using values for its member fields.

like this: ROW(1,2.5,'this is a test')

element values can be accessed via getExprList(),

or getExprList() can be null when it is: row()

See Also:
Constant Field Values

factorial

public static final int factorial
Postgresql factorial:

expr !

expr can be accessed via getLeftOperand()

See Also:
Constant Field Values

squareRoot

public static final int squareRoot
Postgresql square root

|/ 25.0

expr can be accessed via getRightOperand()

See Also:
Constant Field Values

cubeRoot

public static final int cubeRoot
Postgresql cube root

||/ 27.0

expr can be accessed via getRightOperand()

See Also:
Constant Field Values

factorialPrefix

public static final int factorialPrefix
Postgresql factorial (prefix operator):

!! 5

expr can be accessed via getRightOperand()

See Also:
Constant Field Values

absoluteValue

public static final int absoluteValue
Postgresql absolute value

@ -5.0

expr can be accessed via getRightOperand()

See Also:
Constant Field Values

BITWISE_SHIFT_LEFT

public static final int BITWISE_SHIFT_LEFT
Postgresql bitwise shit left

expr << expr

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

BITWISE_SHIFT_RIGHT

public static final int BITWISE_SHIFT_RIGHT
Postgresql bitwise shit right

expr >> expr

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

BITWISE_NOT

public static final int BITWISE_NOT
Postgresql bitwise not

~expr

expr can be accessed via getRightOperand()

See Also:
Constant Field Values

member_of

public static final int member_of
ORACLE

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

UnknownOperator

public static final int UnknownOperator
This UnknownOperator means this expression was not recognized by SQL parser yet.

In syntax like this:

expr OPERATOR expr

expr can be accessed via getLeftOperand() and getRightOperand()

See Also:
Constant Field Values

UnknownUnaryOperator

public static final int UnknownUnaryOperator
This UnknownLeftUnaryOperator means this expression was not recognized by SQL parser yet.

In syntax like this:

OPERATOR expr

expr can be accessed via getRightOperand()

See Also:
Constant Field Values

UnknownUnaryOperatorRight

public static final int UnknownUnaryOperatorRight
This UnknownLeftUnaryOperator means this expression was not recognized by SQL parser yet.

In syntax like this:

expr OPERATOR

expr can be accessed via getLeftOperand()

See Also:
Constant Field Values
Constructor Detail

TExpression

public TExpression()
Method Detail

setOperatorToken

public void setOperatorToken(TSourceToken operatorToken)

getOperatorToken

public TSourceToken getOperatorToken()
Operator token used in expression such as +,-,*,/ and etc

Returns:

setVal

public void setVal(java.lang.Object val)

getVal

public java.lang.Object getVal()
value of this expression, valid only after evaluate this expression.

Returns:

getConstantOperand

public TConstant getConstantOperand()

setNewVariantTypeArgumentList

public void setNewVariantTypeArgumentList(TNewVariantTypeArgumentList newVariantTypeArgumentList)

getNewVariantTypeArgumentList

public TNewVariantTypeArgumentList getNewVariantTypeArgumentList()

setTypeName

public void setTypeName(TTypeName typeName)

getTypeName

public TTypeName getTypeName()

getFieldName

public TObjectName getFieldName()
valid when getExpressionType() is fieldSelection

Returns:

setIndirection

public void setIndirection(TIndirection indirection)

isSubscripts

public boolean isSubscripts()
If an expression yields a value of an array type, then a specific element of the array value can be extracted by writing

expression[subscript]

or multiple adjacent elements (an "array slice") can be extracted by writing

expression[lower_subscript:upper_subscript]

In general the array expression must be parenthesized, but the parentheses can be omitted when the expression to be subscripted is just a column reference or positional parameter.

Also, multiple subscripts can be concatenated when the original array is multidimensional. For example:

when sytnax like this:

mytable.arraycolumn[4]

mytable.two_d_column[17][34]

$1[10:42]

check getObjectOperand() for more detailed information about subscript.

when syntax like this:

(arrayfunction(a,b))[42]

check getIndirection() when isSubscripts() is true.

Returns:

getIndirection

public TIndirection getIndirection()

isNotModifier

public boolean isNotModifier()
return true for expression like this: NOT IS NULL, NOT LIKE , NOT BETWEEN AND and return false for expression like this: IS NULL, LIKE , BETWEEN AND

Returns:

setOutputFormatPhraseList

public void setOutputFormatPhraseList(TOutputFormatPhraseList outputFormatPhraseList)

getOutputFormatPhraseList

public TOutputFormatPhraseList getOutputFormatPhraseList()
Teradata:

column_expr (named alias_name)

Returns:
(named alias_name) in column_expr

getExprList

public TExpressionList getExprList()

setIntervalExpr

public void setIntervalExpr(TIntervalExpression intervalExpr)

getIntervalExpr

public TIntervalExpression getIntervalExpr()

setInExpr

public void setInExpr(TInExpr inExpr)

setExprList

public void setExprList(TExpressionList exprList)

setOracleOuterJoin

public void setOracleOuterJoin(boolean oracleOuterJoin)

isOracleOuterJoin

public boolean isOracleOuterJoin()

getParentExpr

public TExpression getParentExpr()

setParentExpr

public void setParentExpr(TExpression parentExpr)

setLeftOperand

public void setLeftOperand(TExpression leftOperand)

setRightOperand

public void setRightOperand(TExpression rightOperand)

setExpressionType

public void setExpressionType(int expressionType)

getRightOperand

public TExpression getRightOperand()
Returns:
right operand of this expression which should be type of TExpression

getLeftOperand

public TExpression getLeftOperand()
Returns:
left operand of this expression which should be type of TExpression

getLikeEscapeOperand

public TExpression getLikeEscapeOperand()

getBetweenOperand

public TExpression getBetweenOperand()

getArrayAccess

public TArrayAccess getArrayAccess()

getExpressionType

public int getExpressionType()
Returns:
What's kind of expr it is?

setObjectOperand

public void setObjectOperand(TObjectName objectOperand)

getObjectOperand

public TObjectName getObjectOperand()

setConstantOperand

public void setConstantOperand(TConstant constantOperand)

getSourcetokenOperand

public TSourceToken getSourcetokenOperand()

setSourcetokenOperand

public void setSourcetokenOperand(TSourceToken sourcetokenOperand)

setCaseExpression

public void setCaseExpression(TCaseExpression caseExpression)

getCaseExpression

public TCaseExpression getCaseExpression()

setArrayAccess

public void setArrayAccess(TArrayAccess arrayAccess)

setSubQueryNode

public void setSubQueryNode(TSelectSqlNode subQueryNode)

setSubQuery

public void setSubQuery(TSelectSqlStatement subQuery)

getSubQuery

public TSelectSqlStatement getSubQuery()

setSubQueryInStmt

public void setSubQueryInStmt(boolean subQueryInStmt)

getFunctionCall

public TFunctionCall getFunctionCall()

setFunctionCall

public void setFunctionCall(TFunctionCall functionCall)

setDatetimeExpression

public void setDatetimeExpression(TDatetimeExpression datetimeExpression)

setIntervalExpression

public void setIntervalExpression(TIntervalExpression intervalExpression)

setBetweenOperand

public void setBetweenOperand(TExpression betweenOperand)

setLikeEscapeOperand

public void setLikeEscapeOperand(TExpression likeEscapeOperand)

getInExpr

public TInExpr getInExpr()

doParse

public void doParse(TCustomSqlStatement psql,
                    ESqlClause plocation)
Description copied from class: TParseTreeNode
analyze this node

Overrides:
doParse in class TParseTreeNode

getQuantifier

public TSourceToken getQuantifier()
one of the following quantifier keywords: SOME, ANY, ALL

Returns:
SOME, ANY, ALL in group comparison condition.

getComparisonOperator

public TSourceToken getComparisonOperator()
Returns:
operator used in comparison condition.

setComparisonOperator

public void setComparisonOperator(TSourceToken comparisonOperator)

setQuantifier

public void setQuantifier(TSourceToken quantifier)

accept

public void accept(TParseTreeVisitor v)
Specified by:
accept in interface Visitable
Overrides:
accept in class TParseTreeNode

isLeaf

public boolean isLeaf()

isLeafExpr

public boolean isLeafExpr(TParseTreeNode pnode)

setVisitSubTree

public void setVisitSubTree(boolean visitSubTree)

isVisitSubTree

public boolean isVisitSubTree()

preOrderTraverse

public void preOrderTraverse(IExpressionVisitor ev)

inOrderTraverse

public void inOrderTraverse(IExpressionVisitor ev)

postOrderTraverse

public void postOrderTraverse(IExpressionVisitor ev)

addANDCondition

public void addANDCondition(java.lang.String condition)
if original expr is f > 1, and call addANDCondition("f2 > 2") expression will be: f > 1 and f2 > 2

Parameters:
condition -

addORCondition

public void addORCondition(java.lang.String condition)
if original expr is f > 1, and call addORCondition("f2 > 2") expression will be: f > 1 or f2 > 2

Parameters:
condition -

remove

public void remove()
remove this expression from it's parent expr. if itself is the top level expression, then remove it from parse tree

f1 > 1 and f2 > 2, after remove f2>2, parent expression will be changed to: f1 > 1

If we need to remove condition f > 1 from where clause: wherr f > 1, Here f > 1 is the top level expression, after remove it from where clause, only WHERE keyword left in where clause.