Order by clause in select statement was represented by 2 properties:
- SortClauseText, this is the string representation, you can fetch or set order by clause directly by using this property.
- SortClause, which is type of TLzOrderbyList, and represents detailed information about order by clause.
Items in TLzOrderbyList is type of TLzOrderBy which represents each field in order by list.
there are 2 kinds of field that can be represents by TLzOrderBy, use SortItemType which is type of TLzSortItemType to determine type of field.
- sitExpression, use SortExpr which is type of TLzCustomExpression to represent field.
- sitSubquery, use sortSubquery which is type of TCustomSqlStatement to represent field.
Check BuildSelect function in this demo to find out more information:
http://www.sqlparser.com/dl/samples/buildsql.zip