Closed prrvchr closed 2 months ago
You're assuming the inserted row is last, but that is not necessarily the case. When emulated scrollable cursors are used (Firebird 4.0 and older, or Firebird 5.0 with scrollableCursor=EMULATED, the row is inserted on the current position of the result set. Only with server-side scrollable cursors (Firebird 5.0 or higher) are rows inserted at the end.
In other words, in your case, the inserted row is row 9, not row 10.
That said, I do see some oddness in the server-side scrollable case where it reports one row more than it has when I didn't call last() before the insert.
I have plans to retrofit the behaviour for server-side scrollable cursors to emulated cursors as well (so they are inserted at the end), but that will land in Jaybird 6 at the earliest. See also the Jaybird 5 release notes regarding scrollable cursor supports.
Hi Mark,
You're assuming the inserted row is last, but that is not necessarily the case.
actually I didn't really know.
In fact LibreOffice Base considers that an inserted row is inserted after the last row, moreover it positions itself on the last row before the insertion, but I don't think I have the choice to modify this. I'll find out.
Until now I managed the insertions as not visible so I had not yet put my finger on this Base problem...
The problem here is that JDBC does not explicitly define where the newly inserted row should be put. Personally, I do think that it should be at the end, but the original implementation in Jaybird didn't do that. When I implemented server-side scrollable cursor support (which is currently opt-in, and only supported by Firebird 5 and higher), I corrected that, but I didn't want to do that yet for the original implementation.
That behaviour will change in Jaybird 6 or later.
Personally, I do think that it should be at the end
If this is what will be implemented in version 6 then I will make the inserts visible at that time.
Thanks for your explanations which once again were a great help to me.
Thanks for taking the time to report the issue. I will close this ticket. You can track the change of the behaviour through #821.
Hi,
I am trying to implement in LibreOffice Base ResultSet that support the visibility of inserts. During this implementation I realized that it was not possible to reread a new inserted row (in fact we get the last row before the insert)
Here is the code to reproduce the error: