improved sqlserver support, fix #4068

This commit is contained in:
高铁
2020-12-12 14:00:54 +08:00
parent 02d754e0ee
commit 5d0bdf5d61
3 changed files with 12 additions and 0 deletions
@@ -1784,6 +1784,10 @@ public class SQLStatementParser extends SQLParser {
SQLPrimaryKey primaryKey = this.exprParser.parsePrimaryKey();
SQLAlterTableAddConstraint item = new SQLAlterTableAddConstraint(primaryKey);
stmt.addItem(item);
} else if (lexer.token == UNIQUE) {
SQLUnique unique = this.exprParser.parseUnique();
SQLAlterTableAddConstraint item = new SQLAlterTableAddConstraint(unique);
stmt.addItem(item);
} else if (lexer.token == Token.IDENTIFIER) {
SQLAlterTableAddColumn item = parseAlterTableAddColumn();
stmt.addItem(item);
@@ -38,6 +38,10 @@ public class SqlServerResourceTest extends TestCase {
exec_test("bvt/parser/sqlserver-0.txt");
}
public void test_1() throws Exception {
exec_test("bvt/parser/sqlserver-1.txt");
}
public void exec_test(String resource) throws Exception {
// System.out.println(resource);
InputStream is = null;
@@ -0,0 +1,4 @@
ALTER TABLE [dbo].[sys_config] ADD UNIQUE ([param_key] ASC)
---------------------------
ALTER TABLE [dbo].[sys_config]
ADD UNIQUE ([param_key] ASC)