You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Michelle Caisse <Mi...@Sun.COM> on 2007/10/23 02:26:24 UTC
updatable ResultSet: inserted row "may" become visible?
The Derby Developer's Guide states:
Rows inserted to the table may become visible in the result set. (p. 57)
If the inserted row satisfies the query predicate, it may become
visible in the result set. (p. 58)
What does "may" mean? Are there no circumstances in which the insert is
guaranteed to become visible in the result set?
-- Michelle
Re: updatable ResultSet: inserted row "may" become visible?
Posted by Michelle Caisse <Mi...@Sun.COM>.
Thank you for the responses. No guarantees is clearly the answer.
-- Michelle
Jørgen Løland wrote:
> Michelle Caisse wrote:
>
>> The Derby Developer's Guide states:
>>
>> Rows inserted to the table may become visible in the result set.
>> (p. 57)
>>
>> If the inserted row satisfies the query predicate, it may become
>> visible in the result set. (p. 58)
>>
>> What does "may" mean? Are there no circumstances in which the insert
>> is guaranteed to become visible in the result set?
>>
>> -- Michelle
>>
>
> This looks similar to a discussion on derby-dev for update operations
> and open cursors a few months back:
>
> http://www.nabble.com/Updating-rows-with-an-open-cursor...what-is-the-expected-behavior--t3908926.html#a11083342
>
>
> In that discussion, it became clear that the cursor would return rows
> that satisfied the query at the time the row was retrieved. That could
> be any point in time between the cursor creation and when the cursor
> reached that record in the result set. Hence, updates *may* be visible
> to open cursors, but with no guarantees.
>
Re: updatable ResultSet: inserted row "may" become visible?
Posted by Jørgen Løland <Jo...@Sun.COM>.
Michelle Caisse wrote:
> The Derby Developer's Guide states:
>
> Rows inserted to the table may become visible in the result set. (p. 57)
>
> If the inserted row satisfies the query predicate, it may become
> visible in the result set. (p. 58)
>
> What does "may" mean? Are there no circumstances in which the insert is
> guaranteed to become visible in the result set?
>
> -- Michelle
>
This looks similar to a discussion on derby-dev for update operations
and open cursors a few months back:
http://www.nabble.com/Updating-rows-with-an-open-cursor...what-is-the-expected-behavior--t3908926.html#a11083342
In that discussion, it became clear that the cursor would return rows
that satisfied the query at the time the row was retrieved. That could
be any point in time between the cursor creation and when the cursor
reached that record in the result set. Hence, updates *may* be visible
to open cursors, but with no guarantees.
--
Jørgen Løland
Re: updatable ResultSet: inserted row "may" become visible?
Posted by Stanley Bradbury <St...@gmail.com>.
Michelle Caisse wrote:
> The Derby Developer's Guide states:
>
> Rows inserted to the table may become visible in the result set.
> (p. 57)
>
> If the inserted row satisfies the query predicate, it may become
> visible in the result set. (p. 58)
>
> What does "may" mean? Are there no circumstances in which the insert
> is guaranteed to become visible in the result set?
>
> -- Michelle
>
Hi -
I think I found the passage you refer to but it is not on pg 57 in the
10.3 Developers guide I looked at. Please indicate the version of the
manuals or better yet, the section of the document. I found the text
you mentioned in the section "Updatable result sets".
I believe whether the row becomes visible depends on how many rows are
cached at the time the insert is performed. If the entire ResultSet is
already cached you will not see the inserted row because Derby will not
do another read from disk. If, however, you are stepping down through a
large ResultSet where all the records have not been read and the
inserted record sorts below the current position the new record could be
read from the disk when it is reached.
I don't believe there is anyway to predict this behavior.