[
https://issues.apache.org/jira/browse/DERBY-2453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504669
]
Thomas Nielsen edited comment on DERBY-2453 at 6/14/07 4:56 AM:
----------------------------------------------------------------
Agreed, they should behave identical.
Reading the JDBC 4.0 spec, and "JDBC API tutorial and reference, Third edt."
[Fisher, Ellis, Bruce], my interpretation is that PerparedStatement.getMetaData
should return:
a) null if driver cannot supply the information (for whatever reason)
b) a ResultSetMetaData object once the PreparedStatement has been precompiled.
Note that this differs from Statement which needs to perform the execution step
to get the ResultSetMetaData object. PreparedStatement is precompiled, so we
should be able to retrieve the ResultSet column information before execution.
c) a ResultSetMetaData object once the PreparedStatement has been executed.
The ResultSetMetaData object should be empty (but not null) only if the
ResultSet is indeed empty.
If my interpretation is correct, embedded driver does nothing wrong in
returning null (it's simply saying I can't supply the information) although it
should really be able to return a non-empty ResultSetMetaData object once the
PreparedStatement has been precompiled?
The client driver should also be able to return a ResultSetMetaData once the
PreparedStatement has been precompiled?
But then again it will not do any wrong by returning null.
was:
Agreed, they should behave identical.
Reading the JDBC 4.0 spec, and "JDBC API tutorial and reference, Third edt."
[Fisher, Ellis, Bruce], my interpretation is that PerparedStatement.getMetaData
should return:
a) null if driver cannot supply the information (for whatever reason)
b) a ResultSetMetaData object once the PreparedStatement has been precompiled.
Note that this differs from Statement which needs to perform the execution step
to get the ResultSetMetaData object. PreparedStatement is precompiled, so we
should be able to retrieve the ResultSet column information before execution.
c) a ResultSetMetaData object once the PreparedStatement has been executed.
The ResultSetMetaData object should have zero colums only if the ResultSet is
indeed empty.
If my interpretation is correct, embedded driver does nothing wrong in
returning null (it's simply saying I can't supply the information) although it
should really be able to return a non-empty ResultSetMetaData object once the
PreparedStatement has been precompiled?
The client driver should also be able to return a ResultSetMetaData once the
PreparedStatement has been precompiled?
But then again it will not do any wrong by returning null.
> client and embedded differ for return value for PreparedStatement.getMetaData
> if there is no ResultSet returned
> ---------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-2453
> URL: https://issues.apache.org/jira/browse/DERBY-2453
> Project: Derby
> Issue Type: Task
> Components: JDBC, Newcomer
> Affects Versions: 10.3.0.0
> Reporter: Kathey Marsden
>
> Embedded will return a null value for PreparedStatement.getMetaData() if no
> ResultSet is returned. Client will return a ResultSetMetaData object with 0
> columnCount. Looking at the javadoc for getMetaData() it says it returns
> "the description of a ResultSet object's columns or null if the driver cannot
> return a ResultSetMetaData object"
> So I am not sure which is the preferable behavior, but it should be the same.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.