-
Notifications
You must be signed in to change notification settings - Fork 8.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support db2/sqlserver some ddl sql #6343
Open
zycgit
wants to merge
12
commits into
alibaba:master
Choose a base branch
from
ClouGence:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+760
−14
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
18c7703
1. 支持 pg crate/alter/drop schema 语句中同时指定库。
zycgit 44d1126
Merge branch 'alibaba:master' into master
zycgit a6a483e
1.support doris AUTO PARTITION BY RANGE.
zycgit f07f6ec
doris and starrocks index parse
suger-no f5e808f
1.support db2 create schema / drop schema.
zycgit bb9e375
1.fix test case.
zycgit fa64e34
1.add default getName().
zycgit d91a8f2
Merge branch 'alibaba:master' into master
suger-no c6649b1
Merge branch 'alibaba:master' into master
suger-no 800e8c0
sqlserver
suger-no d0c8f9f
db2
suger-no 2b5981b
format code
suger-no File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
core/src/main/java/com/alibaba/druid/sql/dialect/db2/ast/stmt/AsSelectWith.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright 1999-2017 Alibaba Group Holding Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.alibaba.druid.sql.dialect.db2.ast.stmt; | ||
|
||
public enum AsSelectWith { | ||
WITH_DATA | ||
} |
21 changes: 21 additions & 0 deletions
21
core/src/main/java/com/alibaba/druid/sql/dialect/db2/ast/stmt/ConstraintType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright 1999-2017 Alibaba Group Holding Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.alibaba.druid.sql.dialect.db2.ast.stmt; | ||
|
||
public enum ConstraintType { | ||
Unique, | ||
ForeignKey, | ||
} |
60 changes: 60 additions & 0 deletions
60
...src/main/java/com/alibaba/druid/sql/dialect/db2/ast/stmt/DB2AlterTableDropConstraint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright 1999-2017 Alibaba Group Holding Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.alibaba.druid.sql.dialect.db2.ast.stmt; | ||
|
||
import com.alibaba.druid.DbType; | ||
import com.alibaba.druid.sql.ast.statement.SQLAlterTableDropConstraint; | ||
import com.alibaba.druid.sql.ast.statement.SQLAlterTableItem; | ||
import com.alibaba.druid.sql.dialect.db2.ast.DB2Object; | ||
import com.alibaba.druid.sql.dialect.db2.visitor.DB2ASTVisitor; | ||
import com.alibaba.druid.sql.visitor.SQLASTVisitor; | ||
|
||
public class DB2AlterTableDropConstraint extends SQLAlterTableDropConstraint implements SQLAlterTableItem, DB2Object { | ||
protected DbType dbType; | ||
private ConstraintType constraintType; | ||
|
||
public DB2AlterTableDropConstraint() { | ||
this.dbType = DbType.db2; | ||
} | ||
|
||
public DB2AlterTableDropConstraint(DbType dbType) { | ||
this.dbType = dbType; | ||
} | ||
|
||
public ConstraintType getConstraintType() { return constraintType; } | ||
|
||
public void setConstraintType(ConstraintType constraintType) { this.constraintType = constraintType; } | ||
|
||
@Override | ||
protected void accept0(SQLASTVisitor v) { | ||
if (v instanceof DB2ASTVisitor) { | ||
this.accept0((DB2ASTVisitor) v); | ||
} else { | ||
throw new UnsupportedOperationException(this.getClass().getName()); | ||
} | ||
} | ||
|
||
@Override | ||
public void accept0(DB2ASTVisitor visitor) { | ||
if (visitor.visit(this)) { | ||
acceptChild(visitor, this.getConstraintName()); | ||
} | ||
visitor.endVisit(this); | ||
} | ||
|
||
@Override | ||
public DbType getDbType() { return this.dbType; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
core/src/main/java/com/alibaba/druid/sql/dialect/db2/ast/stmt/DB2RenameTableStatement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright 1999-2017 Alibaba Group Holding Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.alibaba.druid.sql.dialect.db2.ast.stmt; | ||
|
||
import com.alibaba.druid.DbType; | ||
import com.alibaba.druid.sql.ast.SQLName; | ||
import com.alibaba.druid.sql.ast.SQLStatementImpl; | ||
import com.alibaba.druid.sql.ast.statement.SQLAlterStatement; | ||
import com.alibaba.druid.sql.dialect.db2.ast.DB2Statement; | ||
import com.alibaba.druid.sql.dialect.db2.visitor.DB2ASTVisitor; | ||
import com.alibaba.druid.sql.visitor.SQLASTVisitor; | ||
|
||
public class DB2RenameTableStatement extends SQLStatementImpl implements DB2Statement, SQLAlterStatement { | ||
private SQLName name; | ||
private SQLName to; | ||
|
||
public DB2RenameTableStatement() { | ||
this.dbType = DbType.db2; | ||
} | ||
|
||
public DB2RenameTableStatement(DbType dbType) { | ||
this.dbType = dbType; | ||
} | ||
|
||
public SQLName getName() { | ||
return name; | ||
} | ||
|
||
public void setName(SQLName name) { | ||
this.name = name; | ||
} | ||
|
||
public SQLName getTo() { | ||
return to; | ||
} | ||
|
||
public void setTo(SQLName to) { | ||
this.to = to; | ||
} | ||
|
||
@Override | ||
protected void accept0(SQLASTVisitor v) { | ||
if (v instanceof DB2ASTVisitor) { | ||
this.accept0((DB2ASTVisitor) v); | ||
} else { | ||
throw new UnsupportedOperationException(this.getClass().getName()); | ||
} | ||
} | ||
|
||
@Override | ||
public void accept0(DB2ASTVisitor visitor) { | ||
if (visitor.visit(this)) { | ||
acceptChild(visitor, name); | ||
acceptChild(visitor, to); | ||
} | ||
visitor.endVisit(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这种为什么不用一个boolean解决?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为还有其它方式,本次只支持了其中一种。如:
create table new_table_name1 as (select * from table1) definition only;
create table new_table_name2 as (select * from table1) with data;
create table new_table_name3 as (select * from table1) WITH no data;