db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r366017 - /db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java
Date Wed, 04 Jan 2006 23:09:41 GMT
Author: tomdz
Date: Wed Jan  4 15:09:39 2006
New Revision: 366017

URL: http://svn.apache.org/viewcvs?rev=366017&view=rev
Log:
Added handling of synthetic default values returned by the database for primary key columns

Modified:
    db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java?rev=366017&r1=366016&r2=366017&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java Wed Jan  4 15:09:39
2006
@@ -17,6 +17,7 @@
  */
 
 import java.io.StringWriter;
+import java.sql.Types;
 import java.util.List;
 
 import org.apache.commons.beanutils.DynaBean;
@@ -128,6 +129,32 @@
                         if (defaultSize != null)
                         {
                             column.setSize(defaultSize.toString());
+                        }
+                    }
+                    // finally the platform might return a synthetic default value if the
column
+                    // is a primary key column
+                    if (getPlatformInfo().isReturningDefaultValueForPrimaryKeys() &&
+                        (column.getDefaultValue() == null) && column.isPrimaryKey())
+                    {
+                        switch (column.getTypeCode())
+                        {
+                            case Types.TINYINT:
+                            case Types.SMALLINT:
+                            case Types.INTEGER:
+                            case Types.BIGINT:
+                                column.setDefaultValue("0");
+                                break;
+                            case Types.REAL:
+                            case Types.FLOAT:
+                            case Types.DOUBLE:
+                                column.setDefaultValue("0.0");
+                                break;
+                            case Types.BIT:
+                                column.setDefaultValue("false");
+                                break;
+                            default:
+                                column.setDefaultValue("");
+                                break;
                         }
                     }
                 }



Mime
View raw message