|
Few more notes:
- i failed to see in standard how cursor should work with rows updated by "positioned update statement" identified by the same cursor - about "positioned delete statement" i see: ----------- 15.5 Effect of a positioned delete 10) Whether the current row is removed from the sequence of rows of the result set descriptor of CR is implementation-defined ----------- our implementation of stable cursor - there is (implementation defined) workaround: if you need that "positioned update" or "positioned delete" statement could see the changes made by another "inner" statements - enclose it into savepoint. For example, add WHEN handler to the current BEGIN\END block: Execute block as declare variable curVal integer; declare variable curID integer; begin for select ID, VAL from TEST_TABLE where VAL>0 into curID, CurVal as cursor TmpCursor do begin update TEST_TABLE set Val=0 where current of TmpCursor; delete from TEST_TABLE where current of TmpCursor; -- error handler is added to force savepoints around statements inside begin\end block when any do exception; end end Probably we should add this to the engine to avoid dependence of positioned statements on presence of additional savepoints... IMHO, this is not the usual behavior. If cursor is stable and "does not see" the changes made in inner statments, then must be the "lock conflict" on last delete statement.
With the current implementation, statement DELETE remove row, which no exists. > IMHO, this is not the usual behavior.
What is "usual" behavior ? Reference on standard would be the best hint ;) Firebird 2.5, for example, performs both UPDATE and DELETE and row is deleted finally. > If cursor is stable and "does not see" the changes made in inner statments, then must be the "lock conflict" on last delete statement. There is no reason for "lock conflict" as both UPDATE and DELETE run at the same transaction. > With the current implementation, statement DELETE remove row, which no exists. DELETE is positioned on current row of cursor, cursor doesn't see effect of inner UPDATE (as i said above), thus cursor position is not invalidated. I agree that positioned UPDATE\DELETE should not depend on savepoint presence, but this is a bit different question. Ok, we need to get used to the new behavior of the cursor.
|
Fix your code, please