db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r418832 - in /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2: Db2Builder.java Db2ModelReader.java
Date Mon, 03 Jul 2006 19:16:57 GMT
Author: tomdz
Date: Mon Jul  3 12:16:57 2006
New Revision: 418832

URL: http://svn.apache.org/viewvc?rev=418832&view=rev
Log:
Fixes for the DB2 platform

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Builder.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Builder.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Builder.java?rev=418832&r1=418831&r2=418832&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Builder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Builder.java Mon Jul  3
12:16:57 2006
@@ -150,7 +150,9 @@
                 AddColumnChange addColumnChange = (AddColumnChange)change;
 
                 // DB2 can only add not insert columns
-                if (addColumnChange.getNextColumn() == null)
+                // Also, DB2 does not allow the GENERATED BY DEFAULT AS IDENTITY clause in
+                // the ALTER TABLE ADD COLUMN statement, so we have to rebuild the table
instead
+                if ((addColumnChange.getNextColumn() == null) && !addColumnChange.getNewColumn().isAutoIncrement())
                 {
                     processChange(currentModel, desiredModel, addColumnChange);
                     change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java?rev=418832&r1=418831&r2=418832&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java Mon Jul
 3 12:16:57 2006
@@ -27,6 +27,7 @@
 import org.apache.ddlutils.model.Column;
 import org.apache.ddlutils.model.Index;
 import org.apache.ddlutils.model.Table;
+import org.apache.ddlutils.model.TypeMap;
 import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
 import org.apache.ddlutils.platform.JdbcModelReader;
 import org.apache.oro.text.regex.MalformedPatternException;
@@ -163,6 +164,10 @@
 					column.setDefaultValue(newDefault.toString());
 				}
 			}
+            else if (TypeMap.isTextType(column.getTypeCode()))
+            {
+                column.setDefaultValue(unescape(column.getDefaultValue(), "'", "''"));
+            }
 		}
 		return column;
 	}



Mime
View raw message