db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r423365 - in /db/ddlutils/trunk/src/java/org/apache/ddlutils: model/Column.java platform/SqlBuilder.java
Date Wed, 19 Jul 2006 04:46:44 GMT
Author: tomdz
Date: Tue Jul 18 21:46:44 2006
New Revision: 423365

URL: http://svn.apache.org/viewvc?rev=423365&view=rev
Log:
Fix for DDLUTILS-114

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

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Column.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Column.java?rev=423365&r1=423364&r2=423365&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Column.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Column.java Tue Jul 18 21:46:44 2006
@@ -319,17 +319,17 @@
         {
             int pos = size.indexOf(",");
 
+            _size  = size;
             if (pos < 0)
             {
-                _size  = size;
-                _scale = 0;
+                _scale     = 0;
+                _sizeAsInt = new Integer(_size);
             }
             else
             {
-                _size  = size.substring(0, pos);
-                _scale = Integer.parseInt(size.substring(pos + 1));
+                _sizeAsInt = new Integer(size.substring(0, pos));
+                _scale     = Integer.parseInt(size.substring(pos + 1));
             }
-            _sizeAsInt = new Integer(_size);
         }
         else
         {
@@ -356,7 +356,7 @@
      */
     public void setScale(int scale)
     {
-        _scale = scale;
+        setSizeAndScale(getSizeAsInt(), scale);
     }
 
     /**
@@ -367,9 +367,13 @@
      */
     public void setSizeAndScale(int size, int scale)
     {
-        _size      = String.valueOf(size);
         _sizeAsInt = new Integer(size);
         _scale     = scale;
+        _size      = String.valueOf(size);
+        if (scale > 0)
+        {
+            _size += "," + _scale;
+        }
     }
     
     /**

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java?rev=423365&r1=423364&r2=423365&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 Tue Jul 18 21:46:44
2006
@@ -2056,7 +2056,7 @@
             else if (getPlatformInfo().hasPrecisionAndScale(column.getTypeCode()))
             {
                 sqlType.append("(");
-                sqlType.append(sizeSpec.toString());
+                sqlType.append(column.getSizeAsInt());
                 sqlType.append(",");
                 sqlType.append(column.getScale());
                 sqlType.append(")");



Mime
View raw message