db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-1744) ResultSet.rowInserted(), rowUpdated() and rowDeleted() don't throw exception on read-only result sets
Date Fri, 25 Aug 2006 15:28:24 GMT
    [ http://issues.apache.org/jira/browse/DERBY-1744?page=comments#action_12430528 ] 
            
Dag H. Wanvik commented on DERBY-1744:
--------------------------------------

Thanks for your investigation, Knut Anders. I can confirm your
findings. Meanwhile I checked the latest API I could find for Mustang
(b97) and found that the wording for rowDeleted differs from the
wording for rowUpdated (and rowInserted) in one substantial respect:

(quote)

> rowDeleted
> 
> boolean rowDeleted() throws SQLException
> 
>     Retrieves whether a row has been deleted. A deleted row may leave
>     a visible "hole" in a result set. This method can be used to
>     detect holes in a result set. The value returned depends on
>     whether or not this ResultSet object can detect deletions.
> 
>     Note: Support for the rowDeleted method is optional with a result
>     set concurrency of CONCUR_READ_ONLY
**************************************

> 
>     Returns: true if the current row is detected to have been deleted
>         by the owner or another; false otherwise
> 
>     Throws:
>         SQLException - if a database access error occurs or this
>         method is called on a closed result set
> 
>         SQLFeatureNotSupportedException - if the JDBC driver does not
>         support this method
******** Note: no requirement that we throw exception if read-only result

>            set. The wording for rowUpdated is different:


In contrast, the wording for rowUpdated is:

> boolean rowUpdated() throws SQLException
> 
>     Retrieves whether the current row has been updated. The value
>     returned depends on whether or not the result set can detect
>     updates.
> 
>     Returns:
> 
>         true if the current row is detected to have been visibly
>         updated by the owner or another; false otherwise
> 
>     Throws:
> 
>         SQLException - if a database access error occurs; the result
>         set concurrency is CONCUR_READ_ONLY or this method is called
>         on a closed result set
*******************************
In this case there is throw requirement.

> 
>         SQLFeatureNotSupportedException - if the JDBC driver does not
>         support this method


In Derby, we currently allow these method calls on read-only result
sets (which was OK with JDBC 3, which specifies SQLException only if
"a data base errros occurs"). Now, the wording has been changed for
both rowUpdated and rowDeleted in JDBC4 (b97), but they seem
inconsistent. Is it really the intention that these two should have a
different behavior on read-only result sets? 

I would prefer it to be allowed (i.e. "support optional") for
rowUpdated also (and rowInserted), since that allows both methods to
work as expected for updates via cursor, which we do allow in Derby if
the underlying result set is updatable (implementation cursor <-> RS
equivalence), even if RS is read-only.

Another data point: Metadata calls (e.g. updatesAreDetected(int type))
do no differentiate between read-only and updatable result sets.  Not
sure if that plays into the equation here, but it seems to me that
since they do not differentiate, and if they do return "true" for a
result set type, then there should be no requirement that we throw an
exception.

I'd like to get this clarified before with proceed with this issue,
I'll ping Lance. Hopefully we can still be allowed to *not* throw
exceptions for rowUpdated, rowInserted.



> ResultSet.rowInserted(), rowUpdated() and rowDeleted() don't throw exception on read-only
result sets
> -----------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1744
>                 URL: http://issues.apache.org/jira/browse/DERBY-1744
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.0.2.1
>            Reporter: Knut Anders Hatlen
>         Assigned To: Knut Anders Hatlen
>            Priority: Minor
>
> These methods should throw SQLException if concurrency is CONCUR_READ_ONLY. See http://download.java.net/jdk6/docs/api/java/sql/ResultSet.html:
> Throws:
>     SQLException - if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY
or this method is called on a closed result set

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message