mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
support sql ast object toString
This commit is contained in:
@@ -26,6 +26,14 @@ public class SQLAlterTableStatement extends SQLStatementImpl implements SQLDDLSt
|
||||
|
||||
private SQLExprTableSource tableSource;
|
||||
private List<SQLAlterTableItem> items = new ArrayList<SQLAlterTableItem>();
|
||||
|
||||
public SQLAlterTableStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLAlterTableStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public List<SQLAlterTableItem> getItems() {
|
||||
return items;
|
||||
|
||||
@@ -33,6 +33,14 @@ public class SQLCallStatement extends SQLStatementImpl {
|
||||
private SQLName procedureName;
|
||||
|
||||
private final List<SQLExpr> parameters = new ArrayList<SQLExpr>();
|
||||
|
||||
public SQLCallStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLCallStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLVariantRefExpr getOutParameter() {
|
||||
return outParameter;
|
||||
|
||||
@@ -33,6 +33,10 @@ public class SQLCreateDatabaseStatement extends SQLStatementImpl {
|
||||
|
||||
public SQLCreateDatabaseStatement(){
|
||||
}
|
||||
|
||||
public SQLCreateDatabaseStatement(String dbType){
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
|
||||
@@ -35,6 +35,10 @@ public class SQLCreateIndexStatement extends SQLStatementImpl implements SQLDDLS
|
||||
public SQLCreateIndexStatement(){
|
||||
|
||||
}
|
||||
|
||||
public SQLCreateIndexStatement(String dbType){
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLTableSource getTable() {
|
||||
return table;
|
||||
|
||||
@@ -33,6 +33,10 @@ public class SQLCreateTableStatement extends SQLStatementImpl implements SQLDDLS
|
||||
public SQLCreateTableStatement(){
|
||||
|
||||
}
|
||||
|
||||
public SQLCreateTableStatement(String dbType){
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLName getName() {
|
||||
if (tableSource == null) {
|
||||
|
||||
@@ -37,6 +37,14 @@ public class SQLCreateTriggerStatement extends SQLStatementImpl {
|
||||
private boolean forEachRow = false;
|
||||
|
||||
private SQLStatement body;
|
||||
|
||||
public SQLCreateTriggerStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLCreateTriggerStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
|
||||
@@ -36,6 +36,10 @@ public class SQLCreateViewStatement extends SQLStatementImpl implements SQLDDLSt
|
||||
public SQLCreateViewStatement(){
|
||||
|
||||
}
|
||||
|
||||
public SQLCreateViewStatement(String dbType){
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public boolean isOrReplace() {
|
||||
return orReplace;
|
||||
|
||||
@@ -29,6 +29,10 @@ public class SQLDeleteStatement extends SQLStatementImpl {
|
||||
public SQLDeleteStatement(){
|
||||
|
||||
}
|
||||
|
||||
public SQLDeleteStatement(String dbType){
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLTableSource getTableSource() {
|
||||
return tableSource;
|
||||
|
||||
@@ -23,6 +23,14 @@ public class SQLDropDatabaseStatement extends SQLStatementImpl implements SQLDDL
|
||||
|
||||
private SQLExpr database;
|
||||
private boolean ifExists;
|
||||
|
||||
public SQLDropDatabaseStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLDropDatabaseStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
|
||||
@@ -23,6 +23,14 @@ public class SQLDropFunctionStatement extends SQLStatementImpl implements SQLDDL
|
||||
|
||||
private SQLName name;
|
||||
private boolean ifExists;
|
||||
|
||||
public SQLDropFunctionStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLDropFunctionStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
|
||||
@@ -23,6 +23,14 @@ public class SQLDropIndexStatement extends SQLStatementImpl implements SQLDDLSta
|
||||
|
||||
private SQLExpr indexName;
|
||||
private SQLExprTableSource tableName;
|
||||
|
||||
public SQLDropIndexStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLDropIndexStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLExpr getIndexName() {
|
||||
return indexName;
|
||||
|
||||
@@ -23,6 +23,14 @@ public class SQLDropProcedureStatement extends SQLStatementImpl implements SQLDD
|
||||
|
||||
private SQLName name;
|
||||
private boolean ifExists;
|
||||
|
||||
public SQLDropProcedureStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLDropProcedureStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
|
||||
@@ -22,6 +22,14 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
public class SQLDropSequenceStatement extends SQLStatementImpl implements SQLDDLStatement {
|
||||
|
||||
private SQLName name;
|
||||
|
||||
public SQLDropSequenceStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLDropSequenceStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
|
||||
@@ -23,6 +23,14 @@ public class SQLDropTableSpaceStatement extends SQLStatementImpl implements SQLD
|
||||
|
||||
private SQLName name;
|
||||
private boolean ifExists;
|
||||
|
||||
public SQLDropTableSpaceStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLDropTableSpaceStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
|
||||
@@ -36,12 +36,25 @@ public class SQLDropTableStatement extends SQLStatementImpl implements SQLDDLSta
|
||||
public SQLDropTableStatement(){
|
||||
|
||||
}
|
||||
|
||||
public SQLDropTableStatement(SQLName name){
|
||||
this(new SQLExprTableSource(name));
|
||||
|
||||
public SQLDropTableStatement(String dbType){
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLDropTableStatement(SQLName name, String dbType){
|
||||
this(new SQLExprTableSource(name), dbType);
|
||||
}
|
||||
|
||||
public SQLDropTableStatement(SQLName name){
|
||||
this (name, null);
|
||||
}
|
||||
|
||||
public SQLDropTableStatement(SQLExprTableSource tableSource){
|
||||
this (tableSource, null);
|
||||
}
|
||||
|
||||
public SQLDropTableStatement(SQLExprTableSource tableSource, String dbType){
|
||||
this (dbType);
|
||||
this.tableSources.add(tableSource);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,14 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
public class SQLDropTriggerStatement extends SQLStatementImpl implements SQLDDLStatement {
|
||||
|
||||
private SQLName name;
|
||||
|
||||
public SQLDropTriggerStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLDropTriggerStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLName getName() {
|
||||
return name;
|
||||
|
||||
@@ -25,6 +25,14 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
public class SQLDropUserStatement extends SQLStatementImpl implements SQLDDLStatement {
|
||||
|
||||
private List<SQLExpr> users = new ArrayList<SQLExpr>(2);
|
||||
|
||||
public SQLDropUserStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLDropUserStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public List<SQLExpr> getUsers() {
|
||||
return users;
|
||||
|
||||
@@ -33,6 +33,10 @@ public class SQLDropViewStatement extends SQLStatementImpl implements SQLDDLStat
|
||||
public SQLDropViewStatement(){
|
||||
|
||||
}
|
||||
|
||||
public SQLDropViewStatement(String dbType){
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLDropViewStatement(SQLName name){
|
||||
this(new SQLExprTableSource(name));
|
||||
|
||||
@@ -27,6 +27,14 @@ public class SQLExplainStatement extends SQLStatementImpl {
|
||||
protected SQLStatement statement;
|
||||
|
||||
private List<SQLCommentHint> hints;
|
||||
|
||||
public SQLExplainStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLExplainStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLStatement getStatement() {
|
||||
return statement;
|
||||
|
||||
@@ -28,6 +28,14 @@ public class SQLGrantStatement extends SQLStatementImpl {
|
||||
|
||||
private SQLExpr on;
|
||||
private SQLExpr to;
|
||||
|
||||
public SQLGrantStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLGrantStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
// mysql
|
||||
private ObjectType objectType;
|
||||
|
||||
@@ -22,6 +22,14 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
public class SQLReleaseSavePointStatement extends SQLStatementImpl {
|
||||
|
||||
private SQLExpr name;
|
||||
|
||||
public SQLReleaseSavePointStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLReleaseSavePointStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLExpr getName() {
|
||||
return name;
|
||||
|
||||
@@ -22,6 +22,14 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
public class SQLRollbackStatement extends SQLStatementImpl {
|
||||
|
||||
private SQLName to;
|
||||
|
||||
public SQLRollbackStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLRollbackStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
|
||||
@@ -22,6 +22,14 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
public class SQLSavePointStatement extends SQLStatementImpl {
|
||||
|
||||
private SQLExpr name;
|
||||
|
||||
public SQLSavePointStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLSavePointStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLExpr getName() {
|
||||
return name;
|
||||
|
||||
@@ -26,10 +26,19 @@ public class SQLSelectStatement extends SQLStatementImpl {
|
||||
|
||||
}
|
||||
|
||||
public SQLSelectStatement(String dbType){
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLSelectStatement(SQLSelect select){
|
||||
this.setSelect(select);
|
||||
}
|
||||
|
||||
public SQLSelectStatement(SQLSelect select, String dbType){
|
||||
this(dbType);
|
||||
this.setSelect(select);
|
||||
}
|
||||
|
||||
public SQLSelect getSelect() {
|
||||
return this.select;
|
||||
}
|
||||
|
||||
@@ -31,8 +31,17 @@ public class SQLSetStatement extends SQLStatementImpl {
|
||||
|
||||
public SQLSetStatement(){
|
||||
}
|
||||
|
||||
|
||||
public SQLSetStatement(String dbType){
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLSetStatement(SQLExpr target, SQLExpr value){
|
||||
this(target, value, null);
|
||||
}
|
||||
|
||||
public SQLSetStatement(SQLExpr target, SQLExpr value, String dbType){
|
||||
super (dbType);
|
||||
this.items.add(new SQLAssignItem(target, value));
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,14 @@ public class SQLTruncateStatement extends SQLStatementImpl {
|
||||
private boolean only;
|
||||
private Boolean restartIdentity;
|
||||
private Boolean cascade;
|
||||
|
||||
public SQLTruncateStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLTruncateStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public List<SQLExprTableSource> getTableSources() {
|
||||
return tableSources;
|
||||
|
||||
@@ -33,6 +33,10 @@ public class SQLUpdateStatement extends SQLStatementImpl {
|
||||
public SQLUpdateStatement(){
|
||||
|
||||
}
|
||||
|
||||
public SQLUpdateStatement(String dbType){
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLTableSource getTableSource() {
|
||||
return tableSource;
|
||||
|
||||
@@ -23,6 +23,14 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
public class SQLUseStatement extends SQLStatementImpl implements SQLStatement {
|
||||
|
||||
private SQLName database;
|
||||
|
||||
public SQLUseStatement() {
|
||||
|
||||
}
|
||||
|
||||
public SQLUseStatement(String dbType) {
|
||||
super (dbType);
|
||||
}
|
||||
|
||||
public SQLName getDatabase() {
|
||||
return database;
|
||||
|
||||
Reference in New Issue
Block a user