db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r373386 - /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java
Date Sun, 29 Jan 2006 23:10:19 GMT
Author: tomdz
Date: Sun Jan 29 15:10:16 2006
New Revision: 373386

URL: http://svn.apache.org/viewcvs?rev=373386&view=rev
Log:
Fixed connection leak
Added more special type handling in setObject

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

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java?rev=373386&r1=373385&r2=373386&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java Sun Jan
29 15:10:16 2006
@@ -1455,7 +1455,16 @@
      */
     public Database readModelFromDatabase(String name, String catalog, String schema, String[]
tableTypes) throws DynaSqlException
     {
-        return readModelFromDatabase(borrowConnection(), name, catalog, schema, tableTypes);
+        Connection connection = borrowConnection();
+
+        try
+        {
+            return readModelFromDatabase(connection, name, catalog, schema, tableTypes);
+        }
+        finally
+        {
+            returnConnection(connection);
+        }
     }
 
     /**
@@ -1546,13 +1555,33 @@
         {
             statement.setNull(sqlIndex, typeCode);
         }
+        else if (value instanceof String)
+        {
+            statement.setString(sqlIndex, (String)value);
+        }
         else if (value instanceof byte[])
         {
             statement.setBytes(sqlIndex, (byte[])value);
         }
-        else if (value instanceof String)
+        else if (value instanceof Boolean)
         {
-            statement.setString(sqlIndex, (String)value);
+            statement.setBoolean(sqlIndex, ((Boolean)value).booleanValue());
+        }
+        else if (value instanceof Byte)
+        {
+            statement.setByte(sqlIndex, ((Byte)value).byteValue());
+        }
+        else if (value instanceof Short)
+        {
+            statement.setShort(sqlIndex, ((Short)value).shortValue());
+        }
+        else if (value instanceof Integer)
+        {
+            statement.setInt(sqlIndex, ((Integer)value).intValue());
+        }
+        else if (value instanceof Long)
+        {
+            statement.setLong(sqlIndex, ((Long)value).longValue());
         }
         else if (value instanceof BigDecimal)
         {



Mime
View raw message