mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser.
This commit is contained in:
+14
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.alibaba.druid.sql.dialect.sqlserver.ast;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLLimit;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLIntegerExpr;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock;
|
||||
import com.alibaba.druid.sql.dialect.sqlserver.visitor.SQLServerASTVisitor;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
@@ -34,6 +36,10 @@ public class SQLServerSelectQueryBlock extends SQLSelectQueryBlock {
|
||||
this.top = top;
|
||||
}
|
||||
|
||||
public void setTop(int rowCount) {
|
||||
setTop(new SQLServerTop(new SQLIntegerExpr(rowCount)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
accept0((SQLServerASTVisitor) visitor);
|
||||
@@ -49,4 +55,12 @@ public class SQLServerSelectQueryBlock extends SQLSelectQueryBlock {
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
public void limit(int rowCount, int offset) {
|
||||
if (offset <= 0) {
|
||||
setTop(rowCount);
|
||||
} else {
|
||||
throw new UnsupportedOperationException("not support offset");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user