Daniel John Debrunner wrote:
Bernt M. Johnsen wrote:
We should also strive to make "insensitivity" as close to the SQL
defintion as possible (SQL 2003 p. 96):
A change to SQL-data is said to be independent of a cursor CR if
and only if it is not made by an <update statement: positioned> or a
<delete statement: positioned> that is positioned on CR.
A change to SQL-data is said to be significant to CR if and only if
it is independent of CR, and, had it been committed before CR was
opened, would have caused the table associated with the cursor to
be different in any respect.
A change to SQL-data is said to be visible to CR if and only if it
has an effect on CR by inserting a row in CR, deleting a row from
CR, changing the value of a column of a row of CR, or reordering
the rows of CR.
[...]
- If the cursor is insensitive, then significant changes are not visible.
Does JDBC's definition of INSENSITIVE line up with SQL's?
JDBC 3.0 (14.1.1) (and JDBC 4.0 16.1.1)
The result set is insensitive to changes made to the underlying data source
while
it is open. It contains the rows that satisfy the query at either the time the
query is
executed or as the rows are retrieved.
SQL seems to say that if an update happens while the cursor is open then
an insensitive cursor will not see it.
JDBC says you might see it, due to the "as the rows are retrieved".
I interpreted the JDBC a bit differently: it just says which rows are in
the resultset, not if you see the updates.
- JDBC 3.0 spec: "The result set is insensitive to changes made to the
underlying data source while it is open. It contains the rows that
satisfy the query at either the time the query is executed or as the
rows are retrieved."
To me, this says more about which rows are in the resultset - if they
satisfy the query at execute time, or at retrieve time, they may go into
the resultset.
Andreas
Dan.