mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve sql parser
This commit is contained in:
@@ -17,7 +17,6 @@ package com.alibaba.druid.sql.ast.statement;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class NotNullConstraint extends SQLConstaintImpl implements SQLColumnConstraint {
|
||||
|
||||
public NotNullConstraint(){
|
||||
|
||||
@@ -23,9 +23,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableAddColumn extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private List<SQLColumnDefinition> columns = new ArrayList<SQLColumnDefinition>();
|
||||
private List<SQLColumnDefinition> columns = new ArrayList<SQLColumnDefinition>();
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
|
||||
@@ -20,14 +20,13 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableAddForeignKey extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SQLForeignKeyConstraint foreignKey;
|
||||
|
||||
public SQLAlterTableAddForeignKey() {
|
||||
|
||||
|
||||
public SQLAlterTableAddForeignKey(){
|
||||
|
||||
}
|
||||
|
||||
public SQLAlterTableAddForeignKey(SQLForeignKeyConstraint foreignKey) {
|
||||
|
||||
public SQLAlterTableAddForeignKey(SQLForeignKeyConstraint foreignKey){
|
||||
this.foreignKey = foreignKey;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,9 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableAddIndex extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLName name;
|
||||
|
||||
private List<SQLSelectOrderByItem> items = new ArrayList<SQLSelectOrderByItem>();
|
||||
private List<SQLSelectOrderByItem> items = new ArrayList<SQLSelectOrderByItem>();
|
||||
|
||||
private String type;
|
||||
|
||||
|
||||
@@ -20,8 +20,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableAddPrimaryKey extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SQLPrimaryKey primaryKey;
|
||||
private SQLPrimaryKey primaryKey;
|
||||
|
||||
public SQLPrimaryKey getPrimaryKey() {
|
||||
return primaryKey;
|
||||
|
||||
@@ -21,8 +21,6 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableAlterColumn extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLColumnDefinition column;
|
||||
|
||||
@Override
|
||||
|
||||
+1
-6
@@ -21,9 +21,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableDisableConstraint extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLName constraintName;
|
||||
private SQLName constraintName;
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
@@ -33,15 +31,12 @@ public class SQLAlterTableDisableConstraint extends SQLObjectImpl implements SQL
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
|
||||
public SQLName getConstraintName() {
|
||||
return constraintName;
|
||||
}
|
||||
|
||||
|
||||
public void setConstraintName(SQLName constraintName) {
|
||||
this.constraintName = constraintName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableDisableKeys extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
|
||||
@@ -24,8 +24,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableDropColumnItem extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private List<SQLName> columns = new ArrayList<SQLName>();
|
||||
private List<SQLName> columns = new ArrayList<SQLName>();
|
||||
|
||||
public SQLAlterTableDropColumnItem(){
|
||||
|
||||
|
||||
@@ -21,9 +21,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableDropConstraint extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLName constraintName;
|
||||
private SQLName constraintName;
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
@@ -33,15 +31,12 @@ public class SQLAlterTableDropConstraint extends SQLObjectImpl implements SQLAlt
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
|
||||
public SQLName getConstraintName() {
|
||||
return constraintName;
|
||||
}
|
||||
|
||||
|
||||
public void setConstraintName(SQLName constraintName) {
|
||||
this.constraintName = constraintName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -21,9 +21,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableDropForeinKey extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLName indexName;
|
||||
private SQLName indexName;
|
||||
|
||||
public SQLName getIndexName() {
|
||||
return indexName;
|
||||
|
||||
@@ -21,9 +21,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableDropIndex extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLName indexName;
|
||||
private SQLName indexName;
|
||||
|
||||
public SQLName getIndexName() {
|
||||
return indexName;
|
||||
|
||||
@@ -20,8 +20,6 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableDropPrimaryKey extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
|
||||
+1
-6
@@ -21,9 +21,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableEnableConstraint extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLName constraintName;
|
||||
private SQLName constraintName;
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
@@ -33,15 +31,12 @@ public class SQLAlterTableEnableConstraint extends SQLObjectImpl implements SQLA
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
|
||||
public SQLName getConstraintName() {
|
||||
return constraintName;
|
||||
}
|
||||
|
||||
|
||||
public void setConstraintName(SQLName constraintName) {
|
||||
this.constraintName = constraintName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableEnableKeys extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
|
||||
@@ -21,9 +21,8 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableRenameColumn extends SQLObjectImpl implements SQLAlterTableItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SQLName column;
|
||||
private SQLName to;
|
||||
private SQLName column;
|
||||
private SQLName to;
|
||||
|
||||
public SQLAlterTableRenameColumn(){
|
||||
|
||||
|
||||
@@ -24,10 +24,8 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAlterTableStatement extends SQLStatementImpl implements SQLDDLStatement {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLExprTableSource tableSource;
|
||||
private List<SQLAlterTableItem> items = new ArrayList<SQLAlterTableItem>();
|
||||
private List<SQLAlterTableItem> items = new ArrayList<SQLAlterTableItem>();
|
||||
|
||||
public List<SQLAlterTableItem> getItems() {
|
||||
return items;
|
||||
@@ -55,7 +53,7 @@ public class SQLAlterTableStatement extends SQLStatementImpl implements SQLDDLSt
|
||||
public void setName(SQLName name) {
|
||||
this.setTableSource(new SQLExprTableSource(name));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
|
||||
@@ -21,10 +21,8 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLAssignItem extends SQLObjectImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLExpr target;
|
||||
private SQLExpr value;
|
||||
private SQLExpr target;
|
||||
private SQLExpr value;
|
||||
|
||||
public SQLAssignItem(){
|
||||
}
|
||||
@@ -65,4 +63,4 @@ public class SQLAssignItem extends SQLObjectImpl {
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,11 +25,9 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLCallStatement extends SQLStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLName procedureName;
|
||||
|
||||
private final List<SQLExpr> parameters = new ArrayList<SQLExpr>();
|
||||
private final List<SQLExpr> parameters = new ArrayList<SQLExpr>();
|
||||
|
||||
public SQLName getProcedureName() {
|
||||
return procedureName;
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.alibaba.druid.sql.ast.statement;
|
||||
import com.alibaba.druid.sql.ast.SQLDataTypeImpl;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class SQLCharactorDataType extends SQLDataTypeImpl {
|
||||
|
||||
private String charSetName;
|
||||
|
||||
@@ -20,15 +20,13 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLCheck extends SQLConstaintImpl implements SQLTableElement {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SQLExpr expr;
|
||||
|
||||
public SQLCheck(){
|
||||
|
||||
private SQLExpr expr;
|
||||
|
||||
public SQLCheck() {
|
||||
|
||||
}
|
||||
|
||||
public SQLCheck(SQLExpr expr) {
|
||||
|
||||
public SQLCheck(SQLExpr expr){
|
||||
this.setExpr(expr);
|
||||
}
|
||||
|
||||
@@ -52,5 +50,4 @@ public class SQLCheck extends SQLConstaintImpl implements SQLTableElement {
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,22 +20,20 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLColumnCheck extends SQLConstaintImpl implements SQLColumnConstraint {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLExpr expr;
|
||||
|
||||
public SQLColumnCheck() {
|
||||
|
||||
|
||||
public SQLColumnCheck(){
|
||||
|
||||
}
|
||||
|
||||
public SQLColumnCheck(SQLExpr expr) {
|
||||
|
||||
public SQLColumnCheck(SQLExpr expr){
|
||||
this.setExpr(expr);
|
||||
}
|
||||
|
||||
|
||||
public SQLExpr getExpr() {
|
||||
return expr;
|
||||
}
|
||||
|
||||
|
||||
public void setExpr(SQLExpr expr) {
|
||||
if (expr != null) {
|
||||
expr.setParent(this);
|
||||
@@ -43,7 +41,6 @@ public class SQLColumnCheck extends SQLConstaintImpl implements SQLColumnConstra
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.alibaba.druid.sql.ast.SQLName;
|
||||
import com.alibaba.druid.sql.ast.SQLObjectImpl;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class SQLColumnDefinition extends SQLObjectImpl implements SQLTableElement {
|
||||
|
||||
protected SQLName name;
|
||||
|
||||
@@ -19,8 +19,6 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLColumnPrimaryKey extends SQLConstaintImpl implements SQLColumnConstraint {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
|
||||
@@ -22,8 +22,6 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLCommentStatement extends SQLObjectImpl implements SQLStatement {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static enum Type {
|
||||
TABLE, COLUMN
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.alibaba.druid.sql.ast.statement;
|
||||
import com.alibaba.druid.sql.ast.SQLName;
|
||||
import com.alibaba.druid.sql.ast.SQLObjectImpl;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class SQLConstaintImpl extends SQLObjectImpl implements SQLConstaint {
|
||||
|
||||
private SQLName name;
|
||||
|
||||
@@ -21,16 +21,14 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLCreateDatabaseStatement extends SQLStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SQLName name;
|
||||
|
||||
private SQLName name;
|
||||
|
||||
private String characterSet;
|
||||
private String collate;
|
||||
private String characterSet;
|
||||
private String collate;
|
||||
|
||||
public SQLCreateDatabaseStatement(){
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
|
||||
@@ -24,16 +24,11 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLCreateIndexStatement extends SQLStatementImpl implements SQLDDLStatement {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLName name;
|
||||
|
||||
private SQLTableSource table;
|
||||
|
||||
private List<SQLSelectOrderByItem> items = new ArrayList<SQLSelectOrderByItem>();
|
||||
private List<SQLSelectOrderByItem> items = new ArrayList<SQLSelectOrderByItem>();
|
||||
|
||||
private String type;
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.alibaba.druid.sql.ast.SQLName;
|
||||
import com.alibaba.druid.sql.ast.SQLStatementImpl;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class SQLCreateTableStatement extends SQLStatementImpl implements SQLDDLStatement {
|
||||
|
||||
protected Type type;
|
||||
|
||||
@@ -25,12 +25,11 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLCreateViewStatement extends SQLStatementImpl implements SQLDDLStatement {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private boolean orReplace = false;
|
||||
private boolean orReplace = false;
|
||||
protected SQLName name;
|
||||
protected SQLSelect subQuery;
|
||||
|
||||
protected final List<SQLExpr> columns = new ArrayList<SQLExpr>();
|
||||
protected final List<SQLExpr> columns = new ArrayList<SQLExpr>();
|
||||
|
||||
private Level with;
|
||||
|
||||
|
||||
@@ -23,9 +23,8 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLDeleteStatement extends SQLStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected SQLTableSource tableSource;
|
||||
protected SQLExpr where;
|
||||
protected SQLTableSource tableSource;
|
||||
protected SQLExpr where;
|
||||
|
||||
public SQLDeleteStatement(){
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLDropIndexStatement extends SQLStatementImpl implements SQLDDLStatement {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLExpr indexName;
|
||||
private SQLExprTableSource tableName;
|
||||
|
||||
@@ -41,7 +39,7 @@ public class SQLDropIndexStatement extends SQLStatementImpl implements SQLDDLSta
|
||||
public void setTableName(SQLExpr tableName) {
|
||||
this.setTableName(new SQLExprTableSource(tableName));
|
||||
}
|
||||
|
||||
|
||||
public void setTableName(SQLExprTableSource tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
@@ -24,9 +24,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLDropTableStatement extends SQLStatementImpl implements SQLDDLStatement {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected List<SQLExprTableSource> tableSources = new ArrayList<SQLExprTableSource>();
|
||||
protected List<SQLExprTableSource> tableSources = new ArrayList<SQLExprTableSource>();
|
||||
|
||||
public SQLDropTableStatement(){
|
||||
|
||||
@@ -51,11 +49,11 @@ public class SQLDropTableStatement extends SQLStatementImpl implements SQLDDLSta
|
||||
public void setName(SQLName name) {
|
||||
this.addTableSource(new SQLExprTableSource(name));
|
||||
}
|
||||
|
||||
|
||||
public void addTableSource(SQLName name) {
|
||||
this.addTableSource(new SQLExprTableSource(name));
|
||||
}
|
||||
|
||||
|
||||
public void addTableSource(SQLExprTableSource tableSource) {
|
||||
tableSources.add(tableSource);
|
||||
}
|
||||
|
||||
@@ -24,9 +24,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLDropViewStatement extends SQLStatementImpl implements SQLDDLStatement {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected List<SQLExprTableSource> tableSources = new ArrayList<SQLExprTableSource>();
|
||||
protected List<SQLExprTableSource> tableSources = new ArrayList<SQLExprTableSource>();
|
||||
|
||||
public SQLDropViewStatement(){
|
||||
|
||||
@@ -51,11 +49,11 @@ public class SQLDropViewStatement extends SQLStatementImpl implements SQLDDLStat
|
||||
public void setName(SQLName name) {
|
||||
this.addTableSource(new SQLExprTableSource(name));
|
||||
}
|
||||
|
||||
|
||||
public void addTableSource(SQLName name) {
|
||||
this.addTableSource(new SQLExprTableSource(name));
|
||||
}
|
||||
|
||||
|
||||
public void addTableSource(SQLExprTableSource tableSource) {
|
||||
tableSources.add(tableSource);
|
||||
}
|
||||
|
||||
@@ -20,28 +20,27 @@ import com.alibaba.druid.sql.ast.SQLHint;
|
||||
import com.alibaba.druid.sql.ast.SQLObjectImpl;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class SQLExprHint extends SQLObjectImpl implements SQLHint {
|
||||
|
||||
private SQLExpr expr;
|
||||
|
||||
public SQLExprHint() {
|
||||
|
||||
|
||||
public SQLExprHint(){
|
||||
|
||||
}
|
||||
|
||||
public SQLExprHint(SQLExpr expr) {
|
||||
|
||||
public SQLExprHint(SQLExpr expr){
|
||||
this.setExpr(expr);
|
||||
}
|
||||
|
||||
public SQLExpr getExpr() {
|
||||
return expr;
|
||||
}
|
||||
|
||||
|
||||
public void setExpr(SQLExpr expr) {
|
||||
if (expr != null) {
|
||||
expr.setParent(this);
|
||||
}
|
||||
|
||||
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
@@ -52,6 +51,5 @@ public class SQLExprHint extends SQLObjectImpl implements SQLHint {
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,9 +20,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLExprTableSource extends SQLTableSourceImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected SQLExpr expr;
|
||||
protected SQLExpr expr;
|
||||
|
||||
public SQLExprTableSource(){
|
||||
|
||||
|
||||
@@ -22,10 +22,9 @@ import com.alibaba.druid.sql.ast.SQLName;
|
||||
|
||||
public abstract class SQLForeignKeyImpl extends SQLConstaintImpl implements SQLForeignKeyConstraint {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SQLName referencedTableName;
|
||||
private List<SQLName> referencingColumns = new ArrayList<SQLName>();
|
||||
private List<SQLName> referencedColumns = new ArrayList<SQLName>();
|
||||
private SQLName referencedTableName;
|
||||
private List<SQLName> referencingColumns = new ArrayList<SQLName>();
|
||||
private List<SQLName> referencedColumns = new ArrayList<SQLName>();
|
||||
|
||||
@Override
|
||||
public List<SQLName> getReferencingColumns() {
|
||||
|
||||
@@ -25,10 +25,9 @@ import com.alibaba.druid.sql.ast.statement.SQLInsertStatement.ValuesClause;
|
||||
|
||||
public abstract class SQLInsertInto extends SQLObjectImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected SQLExprTableSource tableSource;
|
||||
|
||||
protected final List<SQLExpr> columns = new ArrayList<SQLExpr>();
|
||||
protected final List<SQLExpr> columns = new ArrayList<SQLExpr>();
|
||||
protected ValuesClause values;
|
||||
protected SQLSelect query;
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLInsertStatement extends SQLInsertInto implements SQLStatement {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SQLInsertStatement(){
|
||||
|
||||
}
|
||||
@@ -45,7 +43,6 @@ public class SQLInsertStatement extends SQLInsertInto implements SQLStatement {
|
||||
|
||||
public static class ValuesClause extends SQLObjectImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final List<SQLExpr> values;
|
||||
|
||||
public ValuesClause(){
|
||||
|
||||
@@ -23,13 +23,11 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLJoinTableSource extends SQLTableSourceImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected SQLTableSource left;
|
||||
protected JoinType joinType;
|
||||
protected SQLTableSource right;
|
||||
protected SQLExpr condition;
|
||||
protected final List<SQLExpr> using = new ArrayList<SQLExpr>();
|
||||
protected final List<SQLExpr> using = new ArrayList<SQLExpr>();
|
||||
|
||||
public SQLJoinTableSource(String alias){
|
||||
super(alias);
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.alibaba.druid.sql.ast.statement;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class SQLPrimaryKeyImpl extends SQLUnique implements SQLPrimaryKey {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,8 +21,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLReleaseSavePointStatement extends SQLStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SQLExpr name;
|
||||
private SQLExpr name;
|
||||
|
||||
public SQLExpr getName() {
|
||||
return name;
|
||||
|
||||
@@ -21,9 +21,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLRollbackStatement extends SQLStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLName to;
|
||||
private SQLName to;
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
|
||||
@@ -21,8 +21,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLSavePointStatement extends SQLStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SQLExpr name;
|
||||
private SQLExpr name;
|
||||
|
||||
public SQLExpr getName() {
|
||||
return name;
|
||||
|
||||
@@ -21,8 +21,6 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLSelect extends SQLObjectImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected SQLWithSubqueryClause withSubQuery;
|
||||
protected SQLSelectQuery query;
|
||||
protected SQLOrderBy orderBy;
|
||||
|
||||
@@ -24,9 +24,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLSelectGroupByClause extends SQLObjectImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final List<SQLExpr> items = new ArrayList<SQLExpr>();
|
||||
private final List<SQLExpr> items = new ArrayList<SQLExpr>();
|
||||
private SQLExpr having;
|
||||
|
||||
public SQLSelectGroupByClause(){
|
||||
|
||||
@@ -21,10 +21,8 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLSelectItem extends SQLObjectImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLExpr expr;
|
||||
private String alias;
|
||||
private SQLExpr expr;
|
||||
private String alias;
|
||||
|
||||
public SQLSelectItem(){
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLSelectOrderByItem extends SQLObjectImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected SQLExpr expr;
|
||||
protected String collate;
|
||||
protected SQLOrderingSpecification type;
|
||||
@@ -31,7 +29,7 @@ public class SQLSelectOrderByItem extends SQLObjectImpl {
|
||||
public SQLSelectOrderByItem(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
public SQLSelectOrderByItem(SQLExpr expr){
|
||||
this.setExpr(expr);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ import com.alibaba.druid.sql.ast.SQLObjectImpl;
|
||||
|
||||
public abstract class SQLSelectQuery extends SQLObjectImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SQLSelectQuery(){
|
||||
|
||||
}
|
||||
|
||||
@@ -23,10 +23,8 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLSelectQueryBlock extends SQLSelectQuery {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected int distionOption;
|
||||
protected final List<SQLSelectItem> selectList = new ArrayList<SQLSelectItem>();
|
||||
protected final List<SQLSelectItem> selectList = new ArrayList<SQLSelectItem>();
|
||||
|
||||
protected SQLTableSource from;
|
||||
protected SQLExprTableSource into;
|
||||
|
||||
@@ -20,9 +20,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLSelectStatement extends SQLStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected SQLSelect select;
|
||||
protected SQLSelect select;
|
||||
|
||||
public SQLSelectStatement(){
|
||||
|
||||
|
||||
@@ -24,14 +24,12 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLSetStatement extends SQLStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private List<SQLAssignItem> items = new ArrayList<SQLAssignItem>();
|
||||
private List<SQLAssignItem> items = new ArrayList<SQLAssignItem>();
|
||||
|
||||
public SQLSetStatement(){
|
||||
}
|
||||
|
||||
public SQLSetStatement(SQLExpr target, SQLExpr value) {
|
||||
|
||||
public SQLSetStatement(SQLExpr target, SQLExpr value){
|
||||
this.items.add(new SQLAssignItem(target, value));
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLSubqueryTableSource extends SQLTableSourceImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected SQLSelect select;
|
||||
protected SQLSelect select;
|
||||
|
||||
public SQLSubqueryTableSource(){
|
||||
|
||||
|
||||
@@ -23,11 +23,9 @@ import com.alibaba.druid.sql.ast.SQLObjectImpl;
|
||||
|
||||
public abstract class SQLTableSourceImpl extends SQLObjectImpl implements SQLTableSource {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected String alias;
|
||||
|
||||
protected String alias;
|
||||
|
||||
protected List<SQLHint> hints;
|
||||
protected List<SQLHint> hints;
|
||||
|
||||
public SQLTableSourceImpl(){
|
||||
|
||||
@@ -45,12 +43,12 @@ public abstract class SQLTableSourceImpl extends SQLObjectImpl implements SQLTab
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
|
||||
public int getHintsSize() {
|
||||
if (hints == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return hints.size();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLTruncateStatement extends SQLStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected List<SQLExprTableSource> tableSources = new ArrayList<SQLExprTableSource>(2);
|
||||
protected List<SQLExprTableSource> tableSources = new ArrayList<SQLExprTableSource>(2);
|
||||
|
||||
public List<SQLExprTableSource> getTableSources() {
|
||||
return tableSources;
|
||||
@@ -34,7 +33,7 @@ public class SQLTruncateStatement extends SQLStatementImpl {
|
||||
public void setTableSources(List<SQLExprTableSource> tableSources) {
|
||||
this.tableSources = tableSources;
|
||||
}
|
||||
|
||||
|
||||
public void addTableSource(SQLName name) {
|
||||
SQLExprTableSource tableSource = new SQLExprTableSource(name);
|
||||
tableSource.setParent(this);
|
||||
|
||||
@@ -20,12 +20,10 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLUnionQuery extends SQLSelectQuery {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLSelectQuery left;
|
||||
private SQLSelectQuery right;
|
||||
private SQLUnionOperator operator = SQLUnionOperator.UNION;
|
||||
private SQLOrderBy orderBy;
|
||||
private SQLSelectQuery left;
|
||||
private SQLSelectQuery right;
|
||||
private SQLUnionOperator operator = SQLUnionOperator.UNION;
|
||||
private SQLOrderBy orderBy;
|
||||
|
||||
public SQLUnionOperator getOperator() {
|
||||
return operator;
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.List;
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class SQLUnique extends SQLConstaintImpl implements SQLUniqueConstraint, SQLTableElement {
|
||||
|
||||
private final List<SQLExpr> columns = new ArrayList<SQLExpr>();
|
||||
|
||||
@@ -21,10 +21,8 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLUpdateSetItem extends SQLObjectImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLExpr column;
|
||||
private SQLExpr value;
|
||||
private SQLExpr column;
|
||||
private SQLExpr value;
|
||||
|
||||
public SQLUpdateSetItem(){
|
||||
|
||||
|
||||
@@ -25,9 +25,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLUpdateStatement extends SQLStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected final List<SQLUpdateSetItem> items = new ArrayList<SQLUpdateSetItem>();
|
||||
protected final List<SQLUpdateSetItem> items = new ArrayList<SQLUpdateSetItem>();
|
||||
protected SQLExpr where;
|
||||
|
||||
protected SQLTableSource tableSource;
|
||||
@@ -39,7 +37,7 @@ public class SQLUpdateStatement extends SQLStatementImpl {
|
||||
public SQLTableSource getTableSource() {
|
||||
return tableSource;
|
||||
}
|
||||
|
||||
|
||||
public void setTableSource(SQLExpr expr) {
|
||||
this.setTableSource(new SQLExprTableSource(expr));
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLUseStatement extends SQLStatementImpl implements SQLStatement {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SQLName database;
|
||||
private SQLName database;
|
||||
|
||||
public SQLName getDatabase() {
|
||||
return database;
|
||||
|
||||
@@ -25,10 +25,8 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLWithSubqueryClause extends SQLObjectImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Boolean recursive;
|
||||
private final List<Entry> entries = new ArrayList<Entry>();
|
||||
private final List<Entry> entries = new ArrayList<Entry>();
|
||||
|
||||
public List<Entry> getEntries() {
|
||||
return entries;
|
||||
@@ -52,10 +50,9 @@ public class SQLWithSubqueryClause extends SQLObjectImpl {
|
||||
|
||||
public static class Entry extends SQLObjectImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected SQLIdentifierExpr name;
|
||||
protected final List<SQLName> columns = new ArrayList<SQLName>();
|
||||
protected SQLSelect subQuery;
|
||||
protected final List<SQLName> columns = new ArrayList<SQLName>();
|
||||
protected SQLSelect subQuery;
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
|
||||
Reference in New Issue
Block a user