mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor sql parser.
This commit is contained in:
@@ -56,5 +56,6 @@ public interface SQLDataType extends SQLObject {
|
||||
String BIGINT = "BIGINT";
|
||||
String TEXT = "TEXT";
|
||||
String BYTEA = "BYTEA";
|
||||
String BOOLEAN = "BOOLEAN";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
package com.alibaba.druid.sql.ast.expr;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLDataType;
|
||||
import com.alibaba.druid.sql.ast.SQLDataTypeImpl;
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.ast.SQLExprImpl;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLCharacterDataType;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public final class SQLBooleanExpr extends SQLExprImpl implements SQLExpr, SQLLiteralExpr, SQLValuableExpr {
|
||||
public static final SQLDataType DEFAULT_DATA_TYPE = new SQLCharacterDataType("boolean");
|
||||
public static final SQLDataType DEFAULT_DATA_TYPE = new SQLDataTypeImpl(SQLDataType.Constants.BOOLEAN);
|
||||
|
||||
private boolean value;
|
||||
|
||||
@@ -91,4 +92,8 @@ public final class SQLBooleanExpr extends SQLExprImpl implements SQLExpr, SQLLit
|
||||
public SQLBooleanExpr clone() {
|
||||
return new SQLBooleanExpr(value);
|
||||
}
|
||||
|
||||
public static enum Type {
|
||||
ON_OFF
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.alibaba.druid.sql.ast.expr.SQLIntegerExpr;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLSetStatement extends SQLStatementImpl {
|
||||
private Option option;
|
||||
|
||||
private List<SQLAssignItem> items = new ArrayList<SQLAssignItem>();
|
||||
|
||||
@@ -72,6 +73,20 @@ public class SQLSetStatement extends SQLStatementImpl {
|
||||
this.hints = hints;
|
||||
}
|
||||
|
||||
public Option getOption() {
|
||||
return option;
|
||||
}
|
||||
|
||||
public void setOption(Option option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public void set(SQLExpr target, SQLExpr value) {
|
||||
SQLAssignItem assignItem = new SQLAssignItem(target, value);
|
||||
assignItem.setParent(this);
|
||||
this.items.add(assignItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
@@ -110,4 +125,11 @@ public class SQLSetStatement extends SQLStatementImpl {
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
public static enum Option {
|
||||
IDENTITY_INSERT,
|
||||
PASSWORD, // mysql
|
||||
SESSION,
|
||||
LOCAL
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user