db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1234257 - /db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/dbObjectFieldGetter.vm
Date Sat, 21 Jan 2012 03:23:15 GMT
Author: tfischer
Date: Sat Jan 21 03:23:14 2012
New Revision: 1234257

URL: http://svn.apache.org/viewvc?rev=1234257&view=rev
Log:
Handle null values correctly

Modified:
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/dbObjectFieldGetter.vm

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/dbObjectFieldGetter.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/dbObjectFieldGetter.vm?rev=1234257&r1=1234256&r2=1234257&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/dbObjectFieldGetter.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/dbObjectFieldGetter.vm
Sat Jan 21 03:23:14 2012
@@ -38,6 +38,8 @@
          * @param resultSet the ResultSet to read from, not null.
          * @param columnIndex the index in the resultSet which should be read.
          *
+         * @return the content of the column.
+         *
          * @throws SQLException if a problem occurs when reading
          *         from the resultSet.
          */
@@ -69,7 +71,16 @@
                     return false;
                 }
 #else
+  #if ($primitive == "true" || $fieldType == "String")
                 return resultSet.${resultSetGetter}(columnIndex);
+  #else
+                ${fieldType} value = resultSet.${resultSetGetter}(columnIndex);
+                if (resultSet.wasNull())
+                {
+                    value = null;
+                }
+                return value;
+  #end
 #end
             }
             catch (SQLException e)



---------------------------------------------------------------------
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