fix parse create table bug

This commit is contained in:
kiki
2014-03-03 11:29:38 +08:00
parent ff77d596d1
commit d1c5e2215a
14 changed files with 246 additions and 43 deletions
@@ -44,8 +44,9 @@ public class MySqlAlterTableTest_addFk extends TestCase {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("ALTER TABLE Test2" + //
"\n\tADD INDEX FK4CF5DC0F5DD7C31 (test1_name)," + //
"\n\tADD CONSTRAINT FK4CF5DC0F5DD7C31 FOREIGN KEY (name) REFERENCES Test1 (name)", output);
"\n\tADD INDEX FK4CF5DC0F5DD7C31 (test1_name)," + //
"\n\tADD CONSTRAINT FK4CF5DC0F5DD7C31 FOREIGN KEY (test1_name) REFERENCES Test1 (name)",
output);
Assert.assertEquals(2, visitor.getTables().size());
Assert.assertEquals(3, visitor.getColumns().size());
@@ -58,8 +58,8 @@ public class MySqlCreateTableTest48 extends MysqlTest {
+ "\n\tCHANGESET_ID INTEGER, "//
+ "\n\tID INTEGER AUTO_INCREMENT NOT NULL, "//
+ "\n\tREPOSITORY_ID INTEGER, "//
+ "\n\tCONSTRAINT fk_ao_e8b6cc_repo_to_changeset_repository_id FOREIGN KEY (ID) REFERENCES AO_E8B6CC_REPOSITORY_MAPPING (ID), "//
+ "\n\tCONSTRAINT fk_ao_e8b6cc_repo_to_changeset_changeset_id FOREIGN KEY (ID) REFERENCES AO_E8B6CC_CHANGESET_MAPPING (ID), "//
+ "\n\tCONSTRAINT fk_ao_e8b6cc_repo_to_changeset_repository_id FOREIGN KEY (REPOSITORY_ID) REFERENCES AO_E8B6CC_REPOSITORY_MAPPING (ID), "//
+ "\n\tCONSTRAINT fk_ao_e8b6cc_repo_to_changeset_changeset_id FOREIGN KEY (CHANGESET_ID) REFERENCES AO_E8B6CC_CHANGESET_MAPPING (ID), "//
+ "\n\tPRIMARY KEY (ID)"//
+ "\n) ENGINE = InnoDB",//
output);