Select sql statement which includes set operations(union/minus/intersect/except) was also represented by TSelectSqlStatement class just like a simple select statement.
Property SelectSetType(type of TSelectSetType) of TSelectSqlStatement can be used to check the type of this statement. sltNone means it's a simple select, while sltUnion,sltUnionAll,sltMinus,sltIntersect,sltIntersectAll,sltExcept,sltExceptAll means it's a select with set operation.
If it's a select with set operation, then LeftStmt(type of TSelectSqlStatement) is the statement in the left side of the set operation, and RightStmt(type of TSelectSqlStatement) is the statement in the right side of the set operation. usually LeftStmt and RightStmt will be a simple select, but it can also be select with set operation. So you can visit these statement recursively, until a simple select statement was found.
Gudu software http://www.sqlparser.com
|
Send comments about this topic.
|