mysql parser refactor.

This commit is contained in:
wenshao
2017-08-29 14:33:44 +08:00
parent 833a9b5a65
commit 4a4fffbbb2
197 changed files with 3040 additions and 1037 deletions
@@ -299,7 +299,14 @@ public class PagerUtils {
if (query instanceof SQLSelectQueryBlock) {
OracleSelectQueryBlock queryBlock = (OracleSelectQueryBlock) query;
if (queryBlock.getGroupBy() == null && select.getOrderBy() == null && offset <= 0) {
SQLOrderBy orderBy = select.getOrderBy();
if (orderBy == null && queryBlock.getOrderBy() != null) {
orderBy = queryBlock.getOrderBy();
}
if (queryBlock.getGroupBy() == null
&& orderBy == null && offset <= 0) {
SQLExpr where = queryBlock.getWhere();
if (check && where instanceof SQLBinaryOpExpr) {
SQLBinaryOpExpr binaryOpWhere = (SQLBinaryOpExpr) where;
@@ -664,12 +671,16 @@ public class PagerUtils {
if (selectQuery != null) {
SQLOrderBy orderBy = selectQuery.getOrderBy();
SQLObject parent = selectQuery.getParent();
if (parent instanceof SQLSelect) {
if (orderBy == null && parent instanceof SQLSelect) {
SQLSelect select = (SQLSelect) parent;
if (select.getOrderBy() == null || select.getOrderBy().getItems().size() == 0) {
unorderedLimitCount++;
}
orderBy = select.getOrderBy();
}
if (orderBy == null || orderBy.getItems().size() == 0) {
unorderedLimitCount++;
}
}