Bug 168145 - Bookmarkable XResultSet must make positioned insert correctly
Summary: Bookmarkable XResultSet must make positioned insert correctly
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
3.3.0 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:26.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2025-08-27 18:19 UTC by prrvchr
Modified: 2025-09-29 07:40 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description prrvchr 2025-08-27 18:19:59 UTC
Description:
If you use the XRowLocate interface with ResultSets and try to use positioned inserts then you will notice if you look at what Base does during the insert that it tries to get the cursor position while it is still on the insert row.

This can be seen in the code:

https://github.com/LibreOffice/core/blob/master/dbaccess/source/core/api/BookmarkSet.cxx#L87

where Base tries to get a bookmark while it is still on the insert row since the call to the XResultSetUpdate.moveToInsertRow() method on line 78.


Normally, a call to XResultSetUpdate.moveToCurrentRow() should be made before the bookmark call, or better still, positioning it on the last row of the ResultSet with XResultSet.last() would allow the newly inserted row to be obtained as a bookmark.

For now this Base behavior requires handling a call to XResultSet.getRow() while the ResultSet is positioned on the insertion row which is normally not supported by any driver.

The rule seems to be that to exit the insertion row, you must call at least one of the methods that allows absolute positioning of the ResultSet cursor:
- XResultSetUpdate.moveToCurrentRow()
- XResultSet.first()
- XResultSet.last()
- XResultSet.beforefirst()
- XResultSet.afterlast()
- XResultSet.absolute()





Steps to Reproduce:
To reproduce this error, you need an underlying database driver that offers ResultSets with the XRowLocate interface. The problem is that I don't know of any driver other than jdbcDriverOOo that offers this.

Can anyone confirm this?


Actual Results:
Base tries to find out the position of the ResultSet cursor when it has just positioned itself on the insertion line.

Expected Results:
Base should move out of the insertion row before trying to find the cursor position of the ResultSet.


Reproducible: Always


User Profile Reset: No

Additional Info:
No
Comment 2 prrvchr 2025-08-29 00:30:28 UTC
If you use ResultSets with the XRowLocate interface, Base moves to the insertion row in the WrappedResultSet.cxx file, line 73.

And it never returns. Normally, this shouldn't happen, after the insert is done you must go away from the insertion row to continue.
At least that's what it seems to me?
Comment 3 Commit Notification 2025-09-29 07:40:38 UTC
prrvchr committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5d64bdf62af91a896644424c55c28f57e0923cdf

tdf#168145 Base must come out of the insert row

It will be available in 26.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.