db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r382582 - /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdBuilder.java
Date Fri, 03 Mar 2006 00:08:28 GMT
Author: tomdz
Date: Thu Mar  2 16:08:26 2006
New Revision: 382582

URL: http://svn.apache.org/viewcvs?rev=382582&view=rev
Log:
Fixed bug where DdlUtils explicitly referenced Types.BOOLEAN which is only available in JDBC
3

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdBuilder.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdBuilder.java?rev=382582&r1=382581&r2=382582&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdBuilder.java
(original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdBuilder.java
Thu Mar  2 16:08:26 2006
@@ -25,6 +25,7 @@
 import org.apache.ddlutils.model.Database;
 import org.apache.ddlutils.model.Table;
 import org.apache.ddlutils.platform.SqlBuilder;
+import org.apache.ddlutils.util.Jdbc3Utils;
 
 /**
  * The SQL Builder for the FireBird database.
@@ -152,22 +153,19 @@
     }
 
     /**
-     * Returns the native default value for the column.
-     * 
-     * @param column The column
-     * @return The native default value
+     * {@inheritDoc}
      */
     protected String getNativeDefaultValue(Column column)
     {
-        String defaultValue = column.getDefaultValue();
-
-        if ((column.getTypeCode() == Types.BIT) || (column.getTypeCode() == Types.BOOLEAN))
+        if ((column.getTypeCode() == Types.BIT) ||
+            (Jdbc3Utils.supportsJava14JdbcTypes() && (column.getTypeCode() == Jdbc3Utils.determineBooleanTypeCode())))
+        {
+            return getDefaultValueHelper().convert(column.getDefaultValue(), column.getTypeCode(),
Types.SMALLINT).toString();
+        }
+        else
         {
-            defaultValue = getDefaultValueHelper().convert(column.getDefaultValue(),
-                                                           column.getTypeCode(),
-                                                           Types.SMALLINT).toString();
+            return super.getNativeDefaultValue(column);
         }
-        return defaultValue;
     }
 
     /**



Mime
View raw message