Rick Hillegas wrote:
Hi Lance,
I agree with Knut Anders' interpretation of the javadoc for
java.sql.Statement. He is investigating how executeQuery() and
executeUpdate() should behave when the query text invokes a stored
procedure:
1) executeQuery() should raise an error if the procedure does not
return EXACTLY one ResultSet
could be an empty ResultSet but yes 1 ResultSet of some form
2) executeUpdate() should raise an error if the procedure returns ANY
ResultSets. Otherwise executeUpdate() should return 0.
i would expect this to fall into the category of '0 for SQL Statements
that return nothing'
Is this your interpretation, also?
Thanks,
-Rick
[ http://issues.apache.org/jira/browse/DERBY-1288?page=comments#action_12378633 ]
Knut Anders Hatlen commented on DERBY-1288:
-------------------------------------------
What Derby currently does, is
executeQuery:
fails whenever a stored procedure is invoked (both embedded and
client)
executeUpdate:
embedded: fails if no result sets are returned, succeeds if one or
more result sets are returned
client: succeeds regardless of how many result sets are returned,
but the return value is invalid (-1) when no result sets are
returned (it is 0 otherwise)
The way I read the javadoc at http://download.java.net/jdk6/docs/api/,
(1) executeQuery() should fail if the number of result sets returned
is not equal to one, and (2) executeUpdate() should fail if the number
of result sets is not equal to zero, and (3) executeUpdate() should
return 0 if the invocation of the stored procedure was successful. Is
my understanding correct?
Bring Derby into JDBC compliance by supporting executeQuery() on escaped procedure invocations
----------------------------------------------------------------------------------------------
Key: DERBY-1288
URL: http://issues.apache.org/jira/browse/DERBY-1288
Project: Derby
Type: Improvement
Components: JDBC
Versions: 10.2.0.0
Reporter: Rick Hillegas
Assignee: Knut Anders Hatlen
Fix For: 10.2.0.0
The following statement raises an error in Derby:
statement.executeQuery( "{call foo()}" );
although this statement works:
statement.executeUpdate( "{call foo()}" );
According to section 6.4 of the latest draft of the JDBC4 Compliance chapter, both statements are supposed to work in order to claim Java EE JDBC Compliance.
We need to bring Derby into compliance by supporting executeQuery() on escaped procedure invocations.
|