You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by to...@apache.org on 2006/03/01 23:15:27 UTC

svn commit: r382175 - /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java

Author: tomdz
Date: Wed Mar  1 14:15:24 2006
New Revision: 382175

URL: http://svn.apache.org/viewcvs?rev=382175&view=rev
Log:
Added guard that compares column sizes during alteration only if the size matters for the jdbc type and platform

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

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java?rev=382175&r1=382174&r2=382175&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java Wed Mar  1 14:15:24 2006
@@ -1364,16 +1364,14 @@
         String  desiredDefault = desiredColumn.getDefaultValue();
         String  currentDefault = currentColumn.getDefaultValue();
         boolean defaultsEqual  = (desiredDefault == null) || desiredDefault.equals(currentDefault);
-        boolean sizeMatters    = (desiredColumn.getSize() != null);
+        boolean sizeMatters    = getPlatformInfo().hasSize(currentColumn.getTypeCode());
 
         // We're comparing the jdbc type that corresponds to the native type for the
         // desired type, in order to avoid repeated altering of a perfectly valid column
         if ((getPlatformInfo().getTargetJdbcType(desiredColumn.getTypeCode()) != currentColumn.getTypeCode()) ||
             (desiredColumn.isRequired() != currentColumn.isRequired()) ||
-            (sizeMatters && (!desiredColumn.getSize().equals(currentColumn.getSize()))) ||
-            !defaultsEqual /*|| //determined these two to be hardly useful
-            (columnA.getScale() != columnB.getScale()) ||
-            (columnA.getPrecisionRadix() != columnB.getPrecisionRadix())*/ )
+            (sizeMatters && !StringUtils.equals(desiredColumn.getSize(), currentColumn.getSize())) ||
+            !defaultsEqual)
         {
             return true;
         }