? call-update-count.patch Index: org/postgresql/jdbc2/AbstractJdbc2Statement.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v retrieving revision 1.108 diff -c -r1.108 AbstractJdbc2Statement.java *** org/postgresql/jdbc2/AbstractJdbc2Statement.java 1 Feb 2008 10:38:03 -0000 1.108 --- org/postgresql/jdbc2/AbstractJdbc2Statement.java 2 Apr 2008 16:53:23 -0000 *************** *** 492,504 **** public int getUpdateCount() throws SQLException { checkClosed(); ! if (result == null) ! return -1; ! ! if (isFunction) ! return 1; ! ! if (result.getResultSet() != null) return -1; return result.getUpdateCount(); --- 492,498 ---- public int getUpdateCount() throws SQLException { checkClosed(); ! if (result == null || result.getResultSet() != null) return -1; return result.getUpdateCount(); Index: org/postgresql/test/jdbc2/CallableStmtTest.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/test/jdbc2/CallableStmtTest.java,v retrieving revision 1.22 diff -c -r1.22 CallableStmtTest.java *** org/postgresql/test/jdbc2/CallableStmtTest.java 8 Jan 2008 06:56:30 -0000 1.22 --- org/postgresql/test/jdbc2/CallableStmtTest.java 2 Apr 2008 16:53:23 -0000 *************** *** 85,90 **** --- 85,118 ---- final String func = "{ ? = call "; final String pkgName = "testspg__"; + + public void testGetUpdateCount() throws SQLException + { + CallableStatement call = con.prepareCall (func + pkgName + "getDouble (?) }"); + call.setDouble (2, (double)3.04); + call.registerOutParameter (1, Types.DOUBLE); + call.execute (); + assertEquals(-1, call.getUpdateCount()); + assertNull(call.getResultSet()); + assertEquals(42.42, call.getDouble(1), 0.00001); + call.close(); + + // test without an out parameter + call = con.prepareCall( "{ call " + pkgName + "getDouble(?) }"); + call.setDouble( 1, (double)3.04 ); + call.execute(); + assertEquals(-1, call.getUpdateCount()); + ResultSet rs = call.getResultSet(); + assertNotNull(rs); + assertTrue(rs.next()); + assertEquals(42.42, rs.getDouble(1), 0.00001); + assertTrue(!rs.next()); + rs.close(); + + assertEquals(-1, call.getUpdateCount()); + assertTrue(!call.getMoreResults()); + call.close(); + } public void testGetDouble () throws Throwable {