db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r331000 - in /db/torque: generator/trunk/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java runtime/trunk/xdocs/changes.xml
Date Sat, 05 Nov 2005 13:59:25 GMT
Author: tfischer
Date: Sat Nov  5 05:59:18 2005
New Revision: 331000

URL: http://svn.apache.org/viewcvs?rev=331000&view=rev
Log:
Added support for the scale attribute in the JDBCTransformTask.
Thanks to Hilco Wijbenga for the patch

Modified:
    db/torque/generator/trunk/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java
    db/torque/runtime/trunk/xdocs/changes.xml

Modified: db/torque/generator/trunk/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java
URL: http://svn.apache.org/viewcvs/db/torque/generator/trunk/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java?rev=331000&r1=330999&r2=331000&view=diff
==============================================================================
--- db/torque/generator/trunk/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java
(original)
+++ db/torque/generator/trunk/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java
Sat Nov  5 05:59:18 2005
@@ -18,14 +18,12 @@
 
 import java.io.FileOutputStream;
 import java.io.PrintWriter;
-
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Types;
-
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Hashtable;
@@ -34,19 +32,14 @@
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
-
 import org.apache.torque.engine.database.model.TypeMap;
 import org.apache.torque.engine.database.transform.DTDResolver;
-
 import org.apache.xerces.dom.DocumentImpl;
 import org.apache.xerces.dom.DocumentTypeImpl;
-
 import org.apache.xml.serialize.Method;
 import org.apache.xml.serialize.OutputFormat;
 import org.apache.xml.serialize.XMLSerializer;
-
 import org.w3c.dom.Element;
-import org.w3c.dom.Node;
 
 /**
  * This class generates an XML schema of an existing database from
@@ -256,6 +249,7 @@
                     String name = (String) col.get(0);
                     Integer type = ((Integer) col.get(1));
                     int size = ((Integer) col.get(2)).intValue();
+                    int scale = ((Integer) col.get(5)).intValue();
 
                     // From DatabaseMetaData.java
                     //
@@ -278,6 +272,7 @@
                     {
                         column.setAttribute("javaName", name);
                     }
+
                     column.setAttribute("type", TypeMap.getTorqueType(type).getName());
 
                     if (size > 0 && (type.intValue() == Types.CHAR
@@ -289,6 +284,12 @@
                         column.setAttribute("size", String.valueOf(size));
                     }
 
+                    if (scale > 0 && (type.intValue() == Types.DECIMAL
+                            || type.intValue() == Types.NUMERIC))
+                    {
+                        column.setAttribute("scale", String.valueOf(scale));
+                    }
+
                     if (nullType.intValue() == 0)
                     {
                         column.setAttribute("required", "true");
@@ -413,15 +414,17 @@
                 String name = columnSet.getString(4);
                 Integer sqlType = new Integer(columnSet.getString(5));
                 Integer size = new Integer(columnSet.getInt(7));
+                Integer decimalDigits = new Integer(columnSet.getInt(9));
                 Integer nullType = new Integer(columnSet.getInt(11));
                 String defValue = columnSet.getString(13);
 
-                List col = new ArrayList(5);
+                List col = new ArrayList(6);
                 col.add(name);
                 col.add(sqlType);
                 col.add(size);
                 col.add(nullType);
                 col.add(defValue);
+                col.add(decimalDigits);
                 columns.add(col);
             }
         }

Modified: db/torque/runtime/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/db/torque/runtime/trunk/xdocs/changes.xml?rev=331000&r1=330999&r2=331000&view=diff
==============================================================================
--- db/torque/runtime/trunk/xdocs/changes.xml (original)
+++ db/torque/runtime/trunk/xdocs/changes.xml Sat Nov  5 05:59:18 2005
@@ -26,6 +26,13 @@
   <body>
 
   <release version="3.2-rc3-dev" date="in SVN">
+    <action type="add" dev="tfischer">
+      Added scale (i.e number of digits after the decimal point) support 
+      for the sql data types NUMERIC and DECIMAL in the JDBCTransformTask
+      (creating schema.xml from the database). Only scales which are > 0
+      are added as an extra attribute to the generated schema.xml.
+      Thanks to Hilco Wijbenga for the patch.
+    </action>
     <action type="fix" dev="tfischer" issue="TRQS325">
       Fixed importing references for foreign keys if the
       object for the foreign key is in another package.<br />



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message