db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r289996 [3/3] - in /db/ddlutils/trunk: ./ src/java/org/apache/ddlutils/ src/java/org/apache/ddlutils/builder/ src/java/org/apache/ddlutils/model/ src/java/org/apache/ddlutils/platform/ src/test/org/apache/ddlutils/ src/test/org/apache/ddlut...
Date Sun, 18 Sep 2005 23:01:23 GMT
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestOracle8Platform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestOracle8Platform.java?rev=289996&r1=289995&r2=289996&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestOracle8Platform.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestOracle8Platform.java Sun Sep
18 16:00:38 2005
@@ -41,41 +41,113 @@
     public void testColumnTypes() throws Exception
     {
         assertEqualsIgnoringWhitespaces(
-            "DROP TABLE coltype CASCADE CONSTRAINTS;\n"+
-            "CREATE TABLE coltype\n"+
+            "DROP TABLE \"coltype\" CASCADE CONSTRAINTS;\n"+
+            "CREATE TABLE \"coltype\"\n"+
             "(\n"+
-            "    COL_ARRAY           BLOB,\n"+
-            "    COL_BIGINT          NUMBER(38,0),\n"+
-            "    COL_BINARY          RAW(254),\n"+
-            "    COL_BIT             NUMBER(1,0),\n"+
-            "    COL_BLOB            BLOB,\n"+
-            "    COL_BOOLEAN         NUMBER(1,0),\n"+
-            "    COL_CHAR            CHAR(15),\n"+
-            "    COL_CLOB            CLOB,\n"+
-            "    COL_DATALINK        BLOB,\n"+
-            "    COL_DATE            DATE,\n"+
-            "    COL_DECIMAL         NUMBER(15,3),\n"+
-            "    COL_DECIMAL_NOSCALE NUMBER(15,0),\n"+
-            "    COL_DISTINCT        BLOB,\n"+
-            "    COL_DOUBLE          NUMBER(38),\n"+
-            "    COL_FLOAT           NUMBER(38),\n"+
-            "    COL_INTEGER         NUMBER(20,0),\n"+
-            "    COL_JAVA_OBJECT     BLOB,\n"+
-            "    COL_LONGVARBINARY   BLOB,\n"+
-            "    COL_LONGVARCHAR     CLOB,\n"+
-            "    COL_NULL            BLOB,\n"+
-            "    COL_NUMERIC         NUMBER(15,0),\n"+
-            "    COL_OTHER           BLOB,\n"+
-            "    COL_REAL            NUMBER(18),\n"+
-            "    COL_REF             BLOB,\n"+
-            "    COL_SMALLINT        NUMBER(5,0),\n"+
-            "    COL_STRUCT          BLOB,\n"+
-            "    COL_TIME            DATE,\n"+
-            "    COL_TIMESTAMP       DATE,\n"+
-            "    COL_TINYINT         NUMBER(3,0),\n"+
-            "    COL_VARBINARY       RAW(15),\n"+
-            "    COL_VARCHAR         VARCHAR2(15)\n"+
+            "    \"COL_ARRAY\"           BLOB,\n"+
+            "    \"COL_BIGINT\"          NUMBER(38,0),\n"+
+            "    \"COL_BINARY\"          RAW(254),\n"+
+            "    \"COL_BIT\"             NUMBER(1,0),\n"+
+            "    \"COL_BLOB\"            BLOB,\n"+
+            "    \"COL_BOOLEAN\"         NUMBER(1,0),\n"+
+            "    \"COL_CHAR\"            CHAR(15),\n"+
+            "    \"COL_CLOB\"            CLOB,\n"+
+            "    \"COL_DATALINK\"        BLOB,\n"+
+            "    \"COL_DATE\"            DATE,\n"+
+            "    \"COL_DECIMAL\"         NUMBER(15,3),\n"+
+            "    \"COL_DECIMAL_NOSCALE\" NUMBER(15,0),\n"+
+            "    \"COL_DISTINCT\"        BLOB,\n"+
+            "    \"COL_DOUBLE\"          NUMBER(38),\n"+
+            "    \"COL_FLOAT\"           NUMBER(38),\n"+
+            "    \"COL_INTEGER\"         NUMBER(20,0),\n"+
+            "    \"COL_JAVA_OBJECT\"     BLOB,\n"+
+            "    \"COL_LONGVARBINARY\"   BLOB,\n"+
+            "    \"COL_LONGVARCHAR\"     CLOB,\n"+
+            "    \"COL_NULL\"            BLOB,\n"+
+            "    \"COL_NUMERIC\"         NUMBER(15,0),\n"+
+            "    \"COL_OTHER\"           BLOB,\n"+
+            "    \"COL_REAL\"            NUMBER(18),\n"+
+            "    \"COL_REF\"             BLOB,\n"+
+            "    \"COL_SMALLINT\"        NUMBER(5,0),\n"+
+            "    \"COL_STRUCT\"          BLOB,\n"+
+            "    \"COL_TIME\"            DATE,\n"+
+            "    \"COL_TIMESTAMP\"       DATE,\n"+
+            "    \"COL_TINYINT\"         NUMBER(3,0),\n"+
+            "    \"COL_VARBINARY\"       RAW(15),\n"+
+            "    \"COL_VARCHAR\"         VARCHAR2(15)\n"+
             ");\n",
-            createTestDatabase());
+            createTestDatabase(COLUMN_TEST_SCHEMA));
+    }
+
+    /**
+     * Tests the column constraints.
+     */
+    public void testColumnConstraints() throws Exception
+    {
+        assertEqualsIgnoringWhitespaces(
+            "DROP TABLE \"constraints\" CASCADE CONSTRAINTS;\n" +
+            "DROP TRIGGER \"trg_constraints_L_PK_AUTO_INCR\";\n"+
+            "DROP SEQUENCE \"seq_constraints_L_PK_AUTO_INCR\";\n" +
+            "DROP TRIGGER \"trg_constraints_COL_AUTO_INCR\";\n"+
+            "DROP SEQUENCE \"seq_constraints_COL_AUTO_INCR\";\n" +
+            "CREATE SEQUENCE \"seq_constraints_L_PK_AUTO_INCR\";\n" +
+            "CREATE SEQUENCE \"seq_constraints_COL_AUTO_INCR\";\n" +
+            "CREATE TABLE \"constraints\"\n"+
+            "(\n"+
+            "    \"COL_PK\"               VARCHAR2(32),\n"+
+            "    \"COL_PK_AUTO_INCR\"     NUMBER(20,0),\n"+
+            "    \"COL_NOT_NULL\"         RAW(100) NOT NULL,\n"+
+            "    \"COL_NOT_NULL_DEFAULT\" NUMBER(38) DEFAULT '-2.0' NOT NULL,\n"+
+            "    \"COL_DEFAULT\"          CHAR(4) DEFAULT 'test',\n"+
+            "    \"COL_AUTO_INCR\"        NUMBER(38,0),\n"+
+            "    PRIMARY KEY (\"COL_PK\", \"COL_PK_AUTO_INCR\")\n"+
+            ");\n"+
+            "CREATE OR REPLACE TRIGGER \"trg_constraints_L_PK_AUTO_INCR\" BEFORE INSERT ON
\"constraints\" FOR EACH ROW\n"+
+            "BEGIN\n"+
+            "  SELECT \"seq_constraints_L_PK_AUTO_INCR\".nextval INTO :new.\"COL_PK_AUTO_INCR\"
FROM dual;\n"+
+            "END;\n"+
+            "CREATE OR REPLACE TRIGGER \"trg_constraints_COL_AUTO_INCR\" BEFORE INSERT ON
\"constraints\" FOR EACH ROW\n"+
+            "BEGIN\n"+
+            "  SELECT \"seq_constraints_COL_AUTO_INCR\".nextval INTO :new.\"COL_AUTO_INCR\"
FROM dual;\n"+
+            "END;\n",
+            createTestDatabase(COLUMN_CONSTRAINT_TEST_SCHEMA));
+    }
+
+    /**
+     * Tests the table constraints.
+     */
+    public void testTableConstraints() throws Exception
+    {
+        assertEqualsIgnoringWhitespaces(
+            "DROP TABLE \"table3\" CASCADE CONSTRAINTS;\n"+
+            "DROP TABLE \"table2\" CASCADE CONSTRAINTS;\n"+
+            "DROP TABLE \"table1\" CASCADE CONSTRAINTS;\n"+
+            "CREATE TABLE \"table1\"\n"+
+            "(\n"+
+            "    \"COL_PK_1\"    VARCHAR2(32) NOT NULL,\n"+
+            "    \"COL_PK_2\"    NUMBER(20,0),\n"+
+            "    \"COL_INDEX_1\" RAW(100) NOT NULL,\n"+
+            "    \"COL_INDEX_2\" NUMBER(38) NOT NULL,\n"+
+            "    \"COL_INDEX_3\" CHAR(4),\n"+
+            "    PRIMARY KEY (\"COL_PK_1\", \"COL_PK_2\")\n"+
+            ");\n"+
+            "CREATE INDEX \"testindex1\" ON \"table1\" (\"COL_INDEX_2\");\n"+
+            "CREATE UNIQUE INDEX \"testindex2\" ON \"table1\" (\"COL_INDEX_3\", \"COL_INDEX_1\");\n"+
+            "CREATE TABLE \"table2\"\n"+
+            "(\n"+
+            "    \"COL_PK\"   NUMBER(20,0),\n"+
+            "    \"COL_FK_1\" NUMBER(20,0),\n"+
+            "    \"COL_FK_2\" VARCHAR2(32) NOT NULL,\n"+
+            "    PRIMARY KEY (\"COL_PK\")\n"+
+            ");\n"+
+            "CREATE TABLE \"table3\"\n"+
+            "(\n"+
+            "    \"COL_PK\" VARCHAR2(16),\n"+
+            "    \"COL_FK\" NUMBER(20,0) NOT NULL,\n"+
+            "    PRIMARY KEY (\"COL_PK\")\n"+
+            ");\n"+
+            "ALTER TABLE \"table2\" ADD CONSTRAINT \"table2_FK_COL_F_OL_FK_2_table1\" FOREIGN
KEY (\"COL_FK_1\", \"COL_FK_2\") REFERENCES \"table1\" (\"COL_PK_2\", \"COL_PK_1\");\n"+
+            "ALTER TABLE \"table3\" ADD CONSTRAINT \"testfk\" FOREIGN KEY (\"COL_FK\") REFERENCES
\"table2\" (\"COL_PK\");\n",
+            createTestDatabase(TABLE_CONSTRAINT_TEST_SCHEMA));
     }
 }

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestOracle9Platform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestOracle9Platform.java?rev=289996&r1=289995&r2=289996&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestOracle9Platform.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestOracle9Platform.java Sun Sep
18 16:00:38 2005
@@ -41,41 +41,113 @@
     public void testColumnTypes() throws Exception
     {
         assertEqualsIgnoringWhitespaces(
-            "DROP TABLE coltype CASCADE CONSTRAINTS;\n"+
-            "CREATE TABLE coltype\n"+
+            "DROP TABLE \"coltype\" CASCADE CONSTRAINTS;\n"+
+            "CREATE TABLE \"coltype\"\n"+
             "(\n"+
-            "    COL_ARRAY           BLOB,\n"+
-            "    COL_BIGINT          NUMBER(38,0),\n"+
-            "    COL_BINARY          RAW(254),\n"+
-            "    COL_BIT             NUMBER(1,0),\n"+
-            "    COL_BLOB            BLOB,\n"+
-            "    COL_BOOLEAN         NUMBER(1,0),\n"+
-            "    COL_CHAR            CHAR(15),\n"+
-            "    COL_CLOB            CLOB,\n"+
-            "    COL_DATALINK        BLOB,\n"+
-            "    COL_DATE            DATE,\n"+
-            "    COL_DECIMAL         NUMBER(15,3),\n"+
-            "    COL_DECIMAL_NOSCALE NUMBER(15,0),\n"+
-            "    COL_DISTINCT        BLOB,\n"+
-            "    COL_DOUBLE          NUMBER(38),\n"+
-            "    COL_FLOAT           NUMBER(38),\n"+
-            "    COL_INTEGER         NUMBER(20,0),\n"+
-            "    COL_JAVA_OBJECT     BLOB,\n"+
-            "    COL_LONGVARBINARY   BLOB,\n"+
-            "    COL_LONGVARCHAR     CLOB,\n"+
-            "    COL_NULL            BLOB,\n"+
-            "    COL_NUMERIC         NUMBER(15,0),\n"+
-            "    COL_OTHER           BLOB,\n"+
-            "    COL_REAL            NUMBER(18),\n"+
-            "    COL_REF             BLOB,\n"+
-            "    COL_SMALLINT        NUMBER(5,0),\n"+
-            "    COL_STRUCT          BLOB,\n"+
-            "    COL_TIME            DATE,\n"+
-            "    COL_TIMESTAMP       TIMESTAMP,\n"+
-            "    COL_TINYINT         NUMBER(3,0),\n"+
-            "    COL_VARBINARY       RAW(15),\n"+
-            "    COL_VARCHAR         VARCHAR2(15)\n"+
+            "    \"COL_ARRAY\"           BLOB,\n"+
+            "    \"COL_BIGINT\"          NUMBER(38,0),\n"+
+            "    \"COL_BINARY\"          RAW(254),\n"+
+            "    \"COL_BIT\"             NUMBER(1,0),\n"+
+            "    \"COL_BLOB\"            BLOB,\n"+
+            "    \"COL_BOOLEAN\"         NUMBER(1,0),\n"+
+            "    \"COL_CHAR\"            CHAR(15),\n"+
+            "    \"COL_CLOB\"            CLOB,\n"+
+            "    \"COL_DATALINK\"        BLOB,\n"+
+            "    \"COL_DATE\"            DATE,\n"+
+            "    \"COL_DECIMAL\"         NUMBER(15,3),\n"+
+            "    \"COL_DECIMAL_NOSCALE\" NUMBER(15,0),\n"+
+            "    \"COL_DISTINCT\"        BLOB,\n"+
+            "    \"COL_DOUBLE\"          NUMBER(38),\n"+
+            "    \"COL_FLOAT\"           NUMBER(38),\n"+
+            "    \"COL_INTEGER\"         NUMBER(20,0),\n"+
+            "    \"COL_JAVA_OBJECT\"     BLOB,\n"+
+            "    \"COL_LONGVARBINARY\"   BLOB,\n"+
+            "    \"COL_LONGVARCHAR\"     CLOB,\n"+
+            "    \"COL_NULL\"            BLOB,\n"+
+            "    \"COL_NUMERIC\"         NUMBER(15,0),\n"+
+            "    \"COL_OTHER\"           BLOB,\n"+
+            "    \"COL_REAL\"            NUMBER(18),\n"+
+            "    \"COL_REF\"             BLOB,\n"+
+            "    \"COL_SMALLINT\"        NUMBER(5,0),\n"+
+            "    \"COL_STRUCT\"          BLOB,\n"+
+            "    \"COL_TIME\"            DATE,\n"+
+            "    \"COL_TIMESTAMP\"       TIMESTAMP,\n"+
+            "    \"COL_TINYINT\"         NUMBER(3,0),\n"+
+            "    \"COL_VARBINARY\"       RAW(15),\n"+
+            "    \"COL_VARCHAR\"         VARCHAR2(15)\n"+
             ");\n",
-            createTestDatabase());
+            createTestDatabase(COLUMN_TEST_SCHEMA));
+    }
+
+    /**
+     * Tests the column constraints.
+     */
+    public void testColumnConstraints() throws Exception
+    {
+        assertEqualsIgnoringWhitespaces(
+            "DROP TABLE \"constraints\" CASCADE CONSTRAINTS;\n" +
+            "DROP TRIGGER \"trg_constraints_L_PK_AUTO_INCR\";\n"+
+            "DROP SEQUENCE \"seq_constraints_L_PK_AUTO_INCR\";\n" +
+            "DROP TRIGGER \"trg_constraints_COL_AUTO_INCR\";\n"+
+            "DROP SEQUENCE \"seq_constraints_COL_AUTO_INCR\";\n" +
+            "CREATE SEQUENCE \"seq_constraints_L_PK_AUTO_INCR\";\n" +
+            "CREATE SEQUENCE \"seq_constraints_COL_AUTO_INCR\";\n" +
+            "CREATE TABLE \"constraints\"\n"+
+            "(\n"+
+            "    \"COL_PK\"               VARCHAR2(32),\n"+
+            "    \"COL_PK_AUTO_INCR\"     NUMBER(20,0),\n"+
+            "    \"COL_NOT_NULL\"         RAW(100) NOT NULL,\n"+
+            "    \"COL_NOT_NULL_DEFAULT\" NUMBER(38) DEFAULT '-2.0' NOT NULL,\n"+
+            "    \"COL_DEFAULT\"          CHAR(4) DEFAULT 'test',\n"+
+            "    \"COL_AUTO_INCR\"        NUMBER(38,0),\n"+
+            "    PRIMARY KEY (\"COL_PK\", \"COL_PK_AUTO_INCR\")\n"+
+            ");\n"+
+            "CREATE OR REPLACE TRIGGER \"trg_constraints_L_PK_AUTO_INCR\" BEFORE INSERT ON
\"constraints\" FOR EACH ROW\n"+
+            "BEGIN\n"+
+            "  SELECT \"seq_constraints_L_PK_AUTO_INCR\".nextval INTO :new.\"COL_PK_AUTO_INCR\"
FROM dual;\n"+
+            "END;\n"+
+            "CREATE OR REPLACE TRIGGER \"trg_constraints_COL_AUTO_INCR\" BEFORE INSERT ON
\"constraints\" FOR EACH ROW\n"+
+            "BEGIN\n"+
+            "  SELECT \"seq_constraints_COL_AUTO_INCR\".nextval INTO :new.\"COL_AUTO_INCR\"
FROM dual;\n"+
+            "END;\n",
+            createTestDatabase(COLUMN_CONSTRAINT_TEST_SCHEMA));
+    }
+
+    /**
+     * Tests the table constraints.
+     */
+    public void testTableConstraints() throws Exception
+    {
+        assertEqualsIgnoringWhitespaces(
+            "DROP TABLE \"table3\" CASCADE CONSTRAINTS;\n"+
+            "DROP TABLE \"table2\" CASCADE CONSTRAINTS;\n"+
+            "DROP TABLE \"table1\" CASCADE CONSTRAINTS;\n"+
+            "CREATE TABLE \"table1\"\n"+
+            "(\n"+
+            "    \"COL_PK_1\"    VARCHAR2(32) NOT NULL,\n"+
+            "    \"COL_PK_2\"    NUMBER(20,0),\n"+
+            "    \"COL_INDEX_1\" RAW(100) NOT NULL,\n"+
+            "    \"COL_INDEX_2\" NUMBER(38) NOT NULL,\n"+
+            "    \"COL_INDEX_3\" CHAR(4),\n"+
+            "    PRIMARY KEY (\"COL_PK_1\", \"COL_PK_2\")\n"+
+            ");\n"+
+            "CREATE INDEX \"testindex1\" ON \"table1\" (\"COL_INDEX_2\");\n"+
+            "CREATE UNIQUE INDEX \"testindex2\" ON \"table1\" (\"COL_INDEX_3\", \"COL_INDEX_1\");\n"+
+            "CREATE TABLE \"table2\"\n"+
+            "(\n"+
+            "    \"COL_PK\"   NUMBER(20,0),\n"+
+            "    \"COL_FK_1\" NUMBER(20,0),\n"+
+            "    \"COL_FK_2\" VARCHAR2(32) NOT NULL,\n"+
+            "    PRIMARY KEY (\"COL_PK\")\n"+
+            ");\n"+
+            "CREATE TABLE \"table3\"\n"+
+            "(\n"+
+            "    \"COL_PK\" VARCHAR2(16),\n"+
+            "    \"COL_FK\" NUMBER(20,0) NOT NULL,\n"+
+            "    PRIMARY KEY (\"COL_PK\")\n"+
+            ");\n"+
+            "ALTER TABLE \"table2\" ADD CONSTRAINT \"table2_FK_COL_F_OL_FK_2_table1\" FOREIGN
KEY (\"COL_FK_1\", \"COL_FK_2\") REFERENCES \"table1\" (\"COL_PK_2\", \"COL_PK_1\");\n"+
+            "ALTER TABLE \"table3\" ADD CONSTRAINT \"testfk\" FOREIGN KEY (\"COL_FK\") REFERENCES
\"table2\" (\"COL_PK\");\n",
+            createTestDatabase(TABLE_CONSTRAINT_TEST_SCHEMA));
     }
 }

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestPostgresqlPlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestPostgresqlPlatform.java?rev=289996&r1=289995&r2=289996&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestPostgresqlPlatform.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestPostgresqlPlatform.java Sun
Sep 18 16:00:38 2005
@@ -41,41 +41,105 @@
     public void testColumnTypes() throws Exception
     {
         assertEqualsIgnoringWhitespaces(
-            "DROP TABLE coltype CASCADE;\n"+
-            "CREATE TABLE coltype\n"+
+            "DROP TABLE \"coltype\" CASCADE;\n"+
+            "CREATE TABLE \"coltype\"\n"+
             "(\n"+
-            "    COL_ARRAY           BYTEA,\n"+
-            "    COL_BIGINT          BIGINT,\n"+
-            "    COL_BINARY          BYTEA,\n"+
-            "    COL_BIT             BOOLEAN,\n"+
-            "    COL_BLOB            BYTEA,\n"+
-            "    COL_BOOLEAN         BOOLEAN,\n"+
-            "    COL_CHAR            CHAR(15),\n"+
-            "    COL_CLOB            TEXT,\n"+
-            "    COL_DATALINK        BYTEA,\n"+
-            "    COL_DATE            DATE,\n"+
-            "    COL_DECIMAL         NUMERIC(15,3),\n"+
-            "    COL_DECIMAL_NOSCALE NUMERIC(15,0),\n"+
-            "    COL_DISTINCT        BYTEA,\n"+
-            "    COL_DOUBLE          DOUBLE PRECISION,\n"+
-            "    COL_FLOAT           DOUBLE PRECISION,\n"+
-            "    COL_INTEGER         INTEGER,\n"+
-            "    COL_JAVA_OBJECT     BYTEA,\n"+
-            "    COL_LONGVARBINARY   BYTEA,\n"+
-            "    COL_LONGVARCHAR     TEXT,\n"+
-            "    COL_NULL            BYTEA,\n"+
-            "    COL_NUMERIC         NUMERIC(15,0),\n"+
-            "    COL_OTHER           BYTEA,\n"+
-            "    COL_REAL            REAL,\n"+
-            "    COL_REF             BYTEA,\n"+
-            "    COL_SMALLINT        SMALLINT,\n"+
-            "    COL_STRUCT          BYTEA,\n"+
-            "    COL_TIME            TIME,\n"+
-            "    COL_TIMESTAMP       TIMESTAMP,\n"+
-            "    COL_TINYINT         SMALLINT,\n"+
-            "    COL_VARBINARY       BYTEA,\n"+
-            "    COL_VARCHAR         VARCHAR(15)\n"+
+            "    \"COL_ARRAY\"           BYTEA,\n"+
+            "    \"COL_BIGINT\"          BIGINT,\n"+
+            "    \"COL_BINARY\"          BYTEA,\n"+
+            "    \"COL_BIT\"             BOOLEAN,\n"+
+            "    \"COL_BLOB\"            BYTEA,\n"+
+            "    \"COL_BOOLEAN\"         BOOLEAN,\n"+
+            "    \"COL_CHAR\"            CHAR(15),\n"+
+            "    \"COL_CLOB\"            TEXT,\n"+
+            "    \"COL_DATALINK\"        BYTEA,\n"+
+            "    \"COL_DATE\"            DATE,\n"+
+            "    \"COL_DECIMAL\"         NUMERIC(15,3),\n"+
+            "    \"COL_DECIMAL_NOSCALE\" NUMERIC(15,0),\n"+
+            "    \"COL_DISTINCT\"        BYTEA,\n"+
+            "    \"COL_DOUBLE\"          DOUBLE PRECISION,\n"+
+            "    \"COL_FLOAT\"           DOUBLE PRECISION,\n"+
+            "    \"COL_INTEGER\"         INTEGER,\n"+
+            "    \"COL_JAVA_OBJECT\"     BYTEA,\n"+
+            "    \"COL_LONGVARBINARY\"   BYTEA,\n"+
+            "    \"COL_LONGVARCHAR\"     TEXT,\n"+
+            "    \"COL_NULL\"            BYTEA,\n"+
+            "    \"COL_NUMERIC\"         NUMERIC(15,0),\n"+
+            "    \"COL_OTHER\"           BYTEA,\n"+
+            "    \"COL_REAL\"            REAL,\n"+
+            "    \"COL_REF\"             BYTEA,\n"+
+            "    \"COL_SMALLINT\"        SMALLINT,\n"+
+            "    \"COL_STRUCT\"          BYTEA,\n"+
+            "    \"COL_TIME\"            TIME,\n"+
+            "    \"COL_TIMESTAMP\"       TIMESTAMP,\n"+
+            "    \"COL_TINYINT\"         SMALLINT,\n"+
+            "    \"COL_VARBINARY\"       BYTEA,\n"+
+            "    \"COL_VARCHAR\"         VARCHAR(15)\n"+
             ");\n",
-            createTestDatabase());
+            createTestDatabase(COLUMN_TEST_SCHEMA));
+    }
+
+    /**
+     * Tests the column constraints.
+     */
+    public void testColumnConstraints() throws Exception
+    {
+        assertEqualsIgnoringWhitespaces(
+            "DROP TABLE \"constraints\" CASCADE;\n" +
+            "DROP SEQUENCE \"constraints_COL_K_AUTO_INCR_seq\";\n" +
+            "DROP SEQUENCE \"constraints_COL_AUTO_INCR_seq\";\n" +
+            "CREATE SEQUENCE \"constraints_COL_K_AUTO_INCR_seq\";\n" +
+            "CREATE SEQUENCE \"constraints_COL_AUTO_INCR_seq\";\n" +
+            "CREATE TABLE \"constraints\"\n"+
+            "(\n"+
+            "    \"COL_PK\"               VARCHAR(32),\n"+
+            "    \"COL_PK_AUTO_INCR\"     INTEGER UNIQUE DEFAULT nextval(\"constraints_COL_K_AUTO_INCR_seq\"),\n"+
+            "    \"COL_NOT_NULL\"         BYTEA NOT NULL,\n"+
+            "    \"COL_NOT_NULL_DEFAULT\" DOUBLE PRECISION DEFAULT '-2.0' NOT NULL,\n"+
+            "    \"COL_DEFAULT\"          CHAR(4) DEFAULT 'test',\n"+
+            "    \"COL_AUTO_INCR\"        BIGINT UNIQUE DEFAULT nextval(\"constraints_COL_AUTO_INCR_seq\"),\n"+
+            "    PRIMARY KEY (\"COL_PK\", \"COL_PK_AUTO_INCR\")\n"+
+            ");\n",
+            createTestDatabase(COLUMN_CONSTRAINT_TEST_SCHEMA));
+    }
+
+    /**
+     * Tests the table constraints.
+     */
+    public void testTableConstraints() throws Exception
+    {
+        assertEqualsIgnoringWhitespaces(
+            "ALTER TABLE \"table3\" DROP CONSTRAINT \"testfk\";\n"+
+            "ALTER TABLE \"table2\" DROP CONSTRAINT \"table2_FK_COL_F_COL_FK_2_table1\";\n"+
+            "DROP TABLE \"table3\" CASCADE;\n"+
+            "DROP TABLE \"table2\" CASCADE;\n"+
+            "DROP TABLE \"table1\" CASCADE;\n"+
+            "CREATE TABLE \"table1\"\n"+
+            "(\n"+
+            "    \"COL_PK_1\"    VARCHAR(32) NOT NULL,\n"+
+            "    \"COL_PK_2\"    INTEGER,\n"+
+            "    \"COL_INDEX_1\" BYTEA NOT NULL,\n"+
+            "    \"COL_INDEX_2\" DOUBLE PRECISION NOT NULL,\n"+
+            "    \"COL_INDEX_3\" CHAR(4),\n"+
+            "    PRIMARY KEY (\"COL_PK_1\", \"COL_PK_2\")\n"+
+            ");\n"+
+            "CREATE INDEX \"testindex1\" ON \"table1\" (\"COL_INDEX_2\");\n"+
+            "CREATE UNIQUE INDEX \"testindex2\" ON \"table1\" (\"COL_INDEX_3\", \"COL_INDEX_1\");\n"+
+            "CREATE TABLE \"table2\"\n"+
+            "(\n"+
+            "    \"COL_PK\"   INTEGER,\n"+
+            "    \"COL_FK_1\" INTEGER,\n"+
+            "    \"COL_FK_2\" VARCHAR(32) NOT NULL,\n"+
+            "    PRIMARY KEY (\"COL_PK\")\n"+
+            ");\n"+
+            "CREATE TABLE \"table3\"\n"+
+            "(\n"+
+            "    \"COL_PK\" VARCHAR(16),\n"+
+            "    \"COL_FK\" INTEGER NOT NULL,\n"+
+            "    PRIMARY KEY (\"COL_PK\")\n"+
+            ");\n"+
+            "ALTER TABLE \"table2\" ADD CONSTRAINT \"table2_FK_COL_F_COL_FK_2_table1\" FOREIGN
KEY (\"COL_FK_1\", \"COL_FK_2\") REFERENCES \"table1\" (\"COL_PK_2\", \"COL_PK_1\");\n"+
+            "ALTER TABLE \"table3\" ADD CONSTRAINT \"testfk\" FOREIGN KEY (\"COL_FK\") REFERENCES
\"table2\" (\"COL_PK\");\n",
+            createTestDatabase(TABLE_CONSTRAINT_TEST_SCHEMA));
     }
 }

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestSapDbPlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestSapDbPlatform.java?rev=289996&r1=289995&r2=289996&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestSapDbPlatform.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestSapDbPlatform.java Sun Sep
18 16:00:38 2005
@@ -41,41 +41,101 @@
     public void testColumnTypes() throws Exception
     {
         assertEqualsIgnoringWhitespaces(
-            "DROP TABLE coltype CASCADE;\n"+
-            "CREATE TABLE coltype\n"+
+            "DROP TABLE \"coltype\" CASCADE;\n"+
+            "CREATE TABLE \"coltype\"\n"+
             "(\n"+
-            "    COL_ARRAY           LONG BYTE,\n"+
-            "    COL_BIGINT          FIXED(38,0),\n"+
-            "    COL_BINARY          LONG BYTE,\n"+
-            "    COL_BIT             BOOLEAN,\n"+
-            "    COL_BLOB            LONG BYTE,\n"+
-            "    COL_BOOLEAN         BOOLEAN,\n"+
-            "    COL_CHAR            CHAR(15),\n"+
-            "    COL_CLOB            LONG,\n"+
-            "    COL_DATALINK        LONG BYTE,\n"+
-            "    COL_DATE            DATE,\n"+
-            "    COL_DECIMAL         DECIMAL(15,3),\n"+
-            "    COL_DECIMAL_NOSCALE DECIMAL(15,0),\n"+
-            "    COL_DISTINCT        LONG BYTE,\n"+
-            "    COL_DOUBLE          DOUBLE PRECISION,\n"+
-            "    COL_FLOAT           DOUBLE PRECISION,\n"+
-            "    COL_INTEGER         INTEGER,\n"+
-            "    COL_JAVA_OBJECT     LONG BYTE,\n"+
-            "    COL_LONGVARBINARY   LONG BYTE,\n"+
-            "    COL_LONGVARCHAR     LONG VARCHAR,\n"+
-            "    COL_NULL            LONG BYTE,\n"+
-            "    COL_NUMERIC         DECIMAL(15,0),\n"+
-            "    COL_OTHER           LONG BYTE,\n"+
-            "    COL_REAL            REAL,\n"+
-            "    COL_REF             LONG BYTE,\n"+
-            "    COL_SMALLINT        SMALLINT,\n"+
-            "    COL_STRUCT          LONG BYTE,\n"+
-            "    COL_TIME            TIME,\n"+
-            "    COL_TIMESTAMP       TIMESTAMP,\n"+
-            "    COL_TINYINT         SMALLINT,\n"+
-            "    COL_VARBINARY       LONG BYTE,\n"+
-            "    COL_VARCHAR         VARCHAR(15)\n"+
+            "    \"COL_ARRAY\"           LONG BYTE,\n"+
+            "    \"COL_BIGINT\"          FIXED(38,0),\n"+
+            "    \"COL_BINARY\"          LONG BYTE,\n"+
+            "    \"COL_BIT\"             BOOLEAN,\n"+
+            "    \"COL_BLOB\"            LONG BYTE,\n"+
+            "    \"COL_BOOLEAN\"         BOOLEAN,\n"+
+            "    \"COL_CHAR\"            CHAR(15),\n"+
+            "    \"COL_CLOB\"            LONG,\n"+
+            "    \"COL_DATALINK\"        LONG BYTE,\n"+
+            "    \"COL_DATE\"            DATE,\n"+
+            "    \"COL_DECIMAL\"         DECIMAL(15,3),\n"+
+            "    \"COL_DECIMAL_NOSCALE\" DECIMAL(15,0),\n"+
+            "    \"COL_DISTINCT\"        LONG BYTE,\n"+
+            "    \"COL_DOUBLE\"          DOUBLE PRECISION,\n"+
+            "    \"COL_FLOAT\"           DOUBLE PRECISION,\n"+
+            "    \"COL_INTEGER\"         INTEGER,\n"+
+            "    \"COL_JAVA_OBJECT\"     LONG BYTE,\n"+
+            "    \"COL_LONGVARBINARY\"   LONG BYTE,\n"+
+            "    \"COL_LONGVARCHAR\"     LONG VARCHAR,\n"+
+            "    \"COL_NULL\"            LONG BYTE,\n"+
+            "    \"COL_NUMERIC\"         DECIMAL(15,0),\n"+
+            "    \"COL_OTHER\"           LONG BYTE,\n"+
+            "    \"COL_REAL\"            REAL,\n"+
+            "    \"COL_REF\"             LONG BYTE,\n"+
+            "    \"COL_SMALLINT\"        SMALLINT,\n"+
+            "    \"COL_STRUCT\"          LONG BYTE,\n"+
+            "    \"COL_TIME\"            TIME,\n"+
+            "    \"COL_TIMESTAMP\"       TIMESTAMP,\n"+
+            "    \"COL_TINYINT\"         SMALLINT,\n"+
+            "    \"COL_VARBINARY\"       LONG BYTE,\n"+
+            "    \"COL_VARCHAR\"         VARCHAR(15)\n"+
             ");\n",
-            createTestDatabase());
+            createTestDatabase(COLUMN_TEST_SCHEMA));
+    }
+
+    /**
+     * Tests the column constraints.
+     */
+    public void testColumnConstraints() throws Exception
+    {
+        assertEqualsIgnoringWhitespaces(
+            "DROP TABLE \"constraints\" CASCADE;\n" +
+            "CREATE TABLE \"constraints\"\n"+
+            "(\n"+
+            "    \"COL_PK\"               VARCHAR(32),\n"+
+            "    \"COL_PK_AUTO_INCR\"     INTEGER DEFAULT SERIAL(1),\n"+
+            "    \"COL_NOT_NULL\"         LONG BYTE NOT NULL,\n"+
+            "    \"COL_NOT_NULL_DEFAULT\" DOUBLE PRECISION DEFAULT '-2.0' NOT NULL,\n"+
+            "    \"COL_DEFAULT\"          CHAR(4) DEFAULT 'test',\n"+
+            "    \"COL_AUTO_INCR\"        FIXED(38,0) DEFAULT SERIAL(1),\n"+
+            "    PRIMARY KEY (\"COL_PK\", \"COL_PK_AUTO_INCR\")\n"+
+            ");\n",
+            createTestDatabase(COLUMN_CONSTRAINT_TEST_SCHEMA));
+    }
+
+    /**
+     * Tests the table constraints.
+     */
+    public void testTableConstraints() throws Exception
+    {
+        assertEqualsIgnoringWhitespaces(
+            "ALTER TABLE \"table3\" DROP CONSTRAINT \"testfk\";\n"+
+            "ALTER TABLE \"table2\" DROP CONSTRAINT \"table2_FK_COL_FK_COL_FK_2_table1\";\n"+
+            "DROP TABLE \"table3\" CASCADE;\n"+
+            "DROP TABLE \"table2\" CASCADE;\n"+
+            "DROP TABLE \"table1\" CASCADE;\n"+
+            "CREATE TABLE \"table1\"\n"+
+            "(\n"+
+            "    \"COL_PK_1\"    VARCHAR(32) NOT NULL,\n"+
+            "    \"COL_PK_2\"    INTEGER,\n"+
+            "    \"COL_INDEX_1\" LONG BYTE NOT NULL,\n"+
+            "    \"COL_INDEX_2\" DOUBLE PRECISION NOT NULL,\n"+
+            "    \"COL_INDEX_3\" CHAR(4),\n"+
+            "    PRIMARY KEY (\"COL_PK_1\", \"COL_PK_2\")\n"+
+            ");\n"+
+            "CREATE INDEX \"testindex1\" ON \"table1\" (\"COL_INDEX_2\");\n"+
+            "CREATE UNIQUE INDEX \"testindex2\" ON \"table1\" (\"COL_INDEX_3\", \"COL_INDEX_1\");\n"+
+            "CREATE TABLE \"table2\"\n"+
+            "(\n"+
+            "    \"COL_PK\"   INTEGER,\n"+
+            "    \"COL_FK_1\" INTEGER,\n"+
+            "    \"COL_FK_2\" VARCHAR(32) NOT NULL,\n"+
+            "    PRIMARY KEY (\"COL_PK\")\n"+
+            ");\n"+
+            "CREATE TABLE \"table3\"\n"+
+            "(\n"+
+            "    \"COL_PK\" VARCHAR(16),\n"+
+            "    \"COL_FK\" INTEGER NOT NULL,\n"+
+            "    PRIMARY KEY (\"COL_PK\")\n"+
+            ");\n"+
+            "ALTER TABLE \"table2\" ADD CONSTRAINT \"table2_FK_COL_FK_COL_FK_2_table1\" FOREIGN
KEY (\"COL_FK_1\", \"COL_FK_2\") REFERENCES \"table1\" (\"COL_PK_2\", \"COL_PK_1\");\n"+
+            "ALTER TABLE \"table3\" ADD CONSTRAINT \"testfk\" FOREIGN KEY (\"COL_FK\") REFERENCES
\"table2\" (\"COL_PK\");\n",
+            createTestDatabase(TABLE_CONSTRAINT_TEST_SCHEMA));
     }
 }

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestSybasePlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestSybasePlatform.java?rev=289996&r1=289995&r2=289996&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestSybasePlatform.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestSybasePlatform.java Sun Sep
18 16:00:38 2005
@@ -41,44 +41,132 @@
     public void testColumnTypes() throws Exception
     {
         assertEqualsIgnoringWhitespaces(
-            "IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'coltype')\n"+
+            "SET quoted_identifier on;\n"+
+            "SET quoted_identifier on;\n"+
+            "IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = \"coltype\")\n"+
             "BEGIN\n"+
-            "    DROP TABLE coltype\n"+
+            "    DROP TABLE \"coltype\"\n"+
             "END;\n"+
-            "CREATE TABLE coltype\n"+
+            "SET quoted_identifier on;\n"+
+            "CREATE TABLE \"coltype\"\n"+
             "(\n"+
-            "    COL_ARRAY           IMAGE,\n"+
-            "    COL_BIGINT          DECIMAL(19,0),\n"+
-            "    COL_BINARY          BINARY,\n"+
-            "    COL_BIT             BIT,\n"+
-            "    COL_BLOB            IMAGE,\n"+
-            "    COL_BOOLEAN         BIT,\n"+
-            "    COL_CHAR            CHAR(15),\n"+
-            "    COL_CLOB            TEXT,\n"+
-            "    COL_DATALINK        IMAGE,\n"+
-            "    COL_DATE            DATETIME,\n"+
-            "    COL_DECIMAL         DECIMAL(15,3),\n"+
-            "    COL_DECIMAL_NOSCALE DECIMAL(15,0),\n"+
-            "    COL_DISTINCT        IMAGE,\n"+
-            "    COL_DOUBLE          DOUBLE PRECISION,\n"+
-            "    COL_FLOAT           DOUBLE PRECISION,\n"+
-            "    COL_INTEGER         INT,\n"+
-            "    COL_JAVA_OBJECT     IMAGE,\n"+
-            "    COL_LONGVARBINARY   IMAGE,\n"+
-            "    COL_LONGVARCHAR     TEXT,\n"+
-            "    COL_NULL            IMAGE,\n"+
-            "    COL_NUMERIC         NUMERIC(15,0),\n"+
-            "    COL_OTHER           IMAGE,\n"+
-            "    COL_REAL            REAL,\n"+
-            "    COL_REF             IMAGE,\n"+
-            "    COL_SMALLINT        SMALLINT,\n"+
-            "    COL_STRUCT          IMAGE,\n"+
-            "    COL_TIME            DATETIME,\n"+
-            "    COL_TIMESTAMP       DATETIME,\n"+
-            "    COL_TINYINT         SMALLINT,\n"+
-            "    COL_VARBINARY       VARBINARY(15),\n"+
-            "    COL_VARCHAR         VARCHAR(15)\n"+
+            "    \"COL_ARRAY\"           IMAGE,\n"+
+            "    \"COL_BIGINT\"          DECIMAL(19,0),\n"+
+            "    \"COL_BINARY\"          BINARY,\n"+
+            "    \"COL_BIT\"             BIT,\n"+
+            "    \"COL_BLOB\"            IMAGE,\n"+
+            "    \"COL_BOOLEAN\"         BIT,\n"+
+            "    \"COL_CHAR\"            CHAR(15),\n"+
+            "    \"COL_CLOB\"            TEXT,\n"+
+            "    \"COL_DATALINK\"        IMAGE,\n"+
+            "    \"COL_DATE\"            DATETIME,\n"+
+            "    \"COL_DECIMAL\"         DECIMAL(15,3),\n"+
+            "    \"COL_DECIMAL_NOSCALE\" DECIMAL(15,0),\n"+
+            "    \"COL_DISTINCT\"        IMAGE,\n"+
+            "    \"COL_DOUBLE\"          DOUBLE PRECISION,\n"+
+            "    \"COL_FLOAT\"           DOUBLE PRECISION,\n"+
+            "    \"COL_INTEGER\"         INT,\n"+
+            "    \"COL_JAVA_OBJECT\"     IMAGE,\n"+
+            "    \"COL_LONGVARBINARY\"   IMAGE,\n"+
+            "    \"COL_LONGVARCHAR\"     TEXT,\n"+
+            "    \"COL_NULL\"            IMAGE,\n"+
+            "    \"COL_NUMERIC\"         NUMERIC(15,0),\n"+
+            "    \"COL_OTHER\"           IMAGE,\n"+
+            "    \"COL_REAL\"            REAL,\n"+
+            "    \"COL_REF\"             IMAGE,\n"+
+            "    \"COL_SMALLINT\"        SMALLINT,\n"+
+            "    \"COL_STRUCT\"          IMAGE,\n"+
+            "    \"COL_TIME\"            DATETIME,\n"+
+            "    \"COL_TIMESTAMP\"       DATETIME,\n"+
+            "    \"COL_TINYINT\"         SMALLINT,\n"+
+            "    \"COL_VARBINARY\"       VARBINARY(15),\n"+
+            "    \"COL_VARCHAR\"         VARCHAR(15)\n"+
             ");\n",
-            createTestDatabase());
+            createTestDatabase(COLUMN_TEST_SCHEMA));
+    }
+
+    /**
+     * Tests the column constraints.
+     */
+    public void testColumnConstraints() throws Exception
+    {
+        // this is not valid sql as a table can have only one identity column at most 
+        assertEqualsIgnoringWhitespaces(
+            "SET quoted_identifier on;\n"+
+            "SET quoted_identifier on;\n"+
+            "IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = \"constraints\")\n"+
+            "BEGIN\n"+
+            "    DROP TABLE \"constraints\"\n"+
+            "END;\n"+
+            "SET quoted_identifier on;\n"+
+            "CREATE TABLE \"constraints\"\n"+
+            "(\n"+
+            "    \"COL_PK\"               VARCHAR(32),\n"+
+            "    \"COL_PK_AUTO_INCR\"     INT IDENTITY,\n"+
+            "    \"COL_NOT_NULL\"         BINARY(100) NOT NULL,\n"+
+            "    \"COL_NOT_NULL_DEFAULT\" DOUBLE PRECISION DEFAULT '-2.0' NOT NULL,\n"+
+            "    \"COL_DEFAULT\"          CHAR(4) DEFAULT 'test',\n"+
+            "    \"COL_AUTO_INCR\"        DECIMAL(19,0) IDENTITY,\n"+
+            "    PRIMARY KEY (\"COL_PK\", \"COL_PK_AUTO_INCR\")\n"+
+            ");\n",
+            createTestDatabase(COLUMN_CONSTRAINT_TEST_SCHEMA));
+    }
+
+    /**
+     * Tests the table constraints.
+     */
+    public void testTableConstraints() throws Exception
+    {
+        assertEqualsIgnoringWhitespaces(
+            "SET quoted_identifier on;\n"+
+            "ALTER TABLE \"table3\" DROP CONSTRAINT \"testfk\";\n"+
+            "SET quoted_identifier on;\n"+
+            "ALTER TABLE \"table2\" DROP CONSTRAINT \"table2_FK_COL_F_OL_FK_2_table1\";\n"+
+            "SET quoted_identifier on;\n"+
+            "SET quoted_identifier on;\n"+
+            "IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = \"table3\")\n"+
+            "BEGIN\n"+
+            "    DROP TABLE \"table3\"\n"+
+            "END;\n"+
+            "SET quoted_identifier on;\n"+
+            "IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = \"table2\")\n"+
+            "BEGIN\n"+
+            "    DROP TABLE \"table2\"\n"+
+            "END;\n"+
+            "SET quoted_identifier on;\n"+
+            "IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = \"table1\")\n"+
+            "BEGIN\n"+
+            "    DROP TABLE \"table1\"\n"+
+            "END;\n"+
+            "SET quoted_identifier on;\n"+
+            "CREATE TABLE \"table1\"\n"+
+            "(\n"+
+            "    \"COL_PK_1\"    VARCHAR(32) NOT NULL,\n"+
+            "    \"COL_PK_2\"    INT,\n"+
+            "    \"COL_INDEX_1\" BINARY(100) NOT NULL,\n"+
+            "    \"COL_INDEX_2\" DOUBLE PRECISION NOT NULL,\n"+
+            "    \"COL_INDEX_3\" CHAR(4),\n"+
+            "    PRIMARY KEY (\"COL_PK_1\", \"COL_PK_2\")\n"+
+            ");\n"+
+            "CREATE INDEX \"testindex1\" ON \"table1\" (\"COL_INDEX_2\");\n"+
+            "CREATE UNIQUE INDEX \"testindex2\" ON \"table1\" (\"COL_INDEX_3\", \"COL_INDEX_1\");\n"+
+            "SET quoted_identifier on;\n"+
+            "CREATE TABLE \"table2\"\n"+
+            "(\n"+
+            "    \"COL_PK\"   INT,\n"+
+            "    \"COL_FK_1\" INT,\n"+
+            "    \"COL_FK_2\" VARCHAR(32) NOT NULL,\n"+
+            "    PRIMARY KEY (\"COL_PK\")\n"+
+            ");\n"+
+            "SET quoted_identifier on;\n"+
+            "CREATE TABLE \"table3\"\n"+
+            "(\n"+
+            "    \"COL_PK\" VARCHAR(16),\n"+
+            "    \"COL_FK\" INT NOT NULL,\n"+
+            "    PRIMARY KEY (\"COL_PK\")\n"+
+            ");\n"+
+            "ALTER TABLE \"table2\" ADD CONSTRAINT \"table2_FK_COL_F_OL_FK_2_table1\" FOREIGN
KEY (\"COL_FK_1\", \"COL_FK_2\") REFERENCES \"table1\" (\"COL_PK_2\", \"COL_PK_1\");\n"+
+            "ALTER TABLE \"table3\" ADD CONSTRAINT \"testfk\" FOREIGN KEY (\"COL_FK\") REFERENCES
\"table2\" (\"COL_PK\");\n",
+            createTestDatabase(TABLE_CONSTRAINT_TEST_SCHEMA));
     }
 }



Mime
View raw message