db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r378622 - /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mysql/MySqlModelReader.java
Date Fri, 17 Feb 2006 20:45:37 GMT
Author: tomdz
Date: Fri Feb 17 12:45:34 2006
New Revision: 378622

URL: http://svn.apache.org/viewcvs?rev=378622&view=rev
Log:
Added fix for DDLUTILS-71

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mysql/MySqlModelReader.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mysql/MySqlModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mysql/MySqlModelReader.java?rev=378622&r1=378621&r2=378622&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mysql/MySqlModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mysql/MySqlModelReader.java Fri
Feb 17 12:45:34 2006
@@ -17,9 +17,11 @@
  */
 
 import java.sql.SQLException;
+import java.sql.Types;
 import java.util.Map;
 
 import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.model.Column;
 import org.apache.ddlutils.model.ForeignKey;
 import org.apache.ddlutils.model.Index;
 import org.apache.ddlutils.model.Table;
@@ -62,6 +64,23 @@
             determineAutoIncrementFromResultSetMetaData(table, table.getPrimaryKeyColumns());
         }
         return table;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Column readColumn(DatabaseMetaDataWrapper metaData, Map values) throws SQLException
+    {
+        Column column = super.readColumn(metaData, values);
+
+        // MySQL converts illegal date/time/timestamp values to "0000-00-00 00:00:00", but
this
+        // is an illegal ISO value, so we replace it with NULL
+        if ((column.getTypeCode() == Types.TIMESTAMP) && 
+            "0000-00-00 00:00:00".equals(column.getDefaultValue()))
+        {
+            column.setDefaultValue(null);
+        }
+        return column;
     }
 
     /**



Mime
View raw message