db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r629578 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/jdbc/EmbedConnection.java testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoGenJDBC30Test.java
Date Wed, 20 Feb 2008 19:18:37 GMT
Author: kmarsden
Date: Wed Feb 20 11:18:32 2008
New Revision: 629578

URL: http://svn.apache.org/viewvc?rev=629578&view=rev
Log:
DERBY-3430 Inconsistency in JDBC autogen APIs between Connection.prepareStatement(...) and
Statement.execute(...)

Change prepareStatement to treat empty arrays for columnNames or columnIndexes as NO_GENERATED_KEYS


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoGenJDBC30Test.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=629578&r1=629577&r2=629578&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java Wed Feb
20 11:18:32 2008
@@ -1213,7 +1213,7 @@
 			JDBC20Translation.TYPE_FORWARD_ONLY,
 			JDBC20Translation.CONCUR_READ_ONLY,
 			connectionHoldAbility,
-			columnIndexes == null
+			(columnIndexes == null || columnIndexes.length == 0)
 				? JDBC30Translation.NO_GENERATED_KEYS
 				: JDBC30Translation.RETURN_GENERATED_KEYS,
 			columnIndexes,
@@ -1248,7 +1248,7 @@
 			JDBC20Translation.TYPE_FORWARD_ONLY,
 			JDBC20Translation.CONCUR_READ_ONLY,
 			connectionHoldAbility,
-			columnNames == null
+			(columnNames == null || columnNames.length == 0)
 				? JDBC30Translation.NO_GENERATED_KEYS
 				: JDBC30Translation.RETURN_GENERATED_KEYS,
 			null,

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoGenJDBC30Test.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoGenJDBC30Test.java?rev=629578&r1=629577&r2=629578&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoGenJDBC30Test.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoGenJDBC30Test.java
Wed Feb 20 11:18:32 2008
@@ -1116,19 +1116,16 @@
             s.getGeneratedKeys());
 
         PreparedStatement ps = null;
-        if (!usingEmbedded())
-        {
-            // Can't run these with embedded now because of DERBY-3430
-            ps = prepareStatement(sql, new String[] {});
-            ps.execute();
-            assertNull("Expected NULL ResultSet after ps.execute()", 
-            ps.getGeneratedKeys());
+        
+        ps = prepareStatement(sql, new String[] {});
+        ps.execute();
+        assertNull("Expected NULL ResultSet after ps.execute()", 
+        ps.getGeneratedKeys());
 
-            ps = prepareStatement(sql, new String[] {});
-            ps.executeUpdate();
-            assertNull("Expected NULL ResultSet after ps.executeUpdate()", 
-                    ps.getGeneratedKeys());
-        }
+        ps = prepareStatement(sql, new String[] {});
+        ps.executeUpdate();
+        assertNull("Expected NULL ResultSet after ps.executeUpdate()", 
+                ps.getGeneratedKeys());       
        // No columnIndexes yet for derby client. 
        if (usingDerbyNetClient())
             return;



Mime
View raw message