mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor sql parser. sqlite support limit clause. #1556
This commit is contained in:
@@ -45,7 +45,6 @@ import com.alibaba.druid.sql.ast.SQLLimit;
|
||||
import com.alibaba.druid.sql.dialect.odps.ast.OdpsSelectQueryBlock;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSelectQueryBlock;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGSelectQueryBlock;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGSelectQueryBlock.PGLimit;
|
||||
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock;
|
||||
import com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerTop;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
@@ -129,7 +128,7 @@ public class PagerUtils {
|
||||
throw new IllegalArgumentException("limit already exists.");
|
||||
}
|
||||
|
||||
PGLimit limit = new PGLimit();
|
||||
SQLLimit limit = new SQLLimit();
|
||||
if (offset > 0) {
|
||||
limit.setOffset(new SQLIntegerExpr(offset));
|
||||
}
|
||||
@@ -487,7 +486,8 @@ public class PagerUtils {
|
||||
}
|
||||
|
||||
if (query instanceof OdpsSelectQueryBlock) {
|
||||
SQLExpr rowCountExpr = ((OdpsSelectQueryBlock) query).getLimit();
|
||||
SQLLimit limit = ((OdpsSelectQueryBlock) query).getLimit();
|
||||
SQLExpr rowCountExpr = limit != null ? limit.getRowCount() : null;
|
||||
|
||||
if (rowCountExpr instanceof SQLNumericLiteralExpr) {
|
||||
int rowCount = ((SQLNumericLiteralExpr) rowCountExpr).getNumber().intValue();
|
||||
|
||||
Reference in New Issue
Block a user