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
When performing an positioned insert on a ResultSet supporting the XRowLocate interface, the following calls are made by Base: - https://github.com/LibreOffice/core/blob/master/dbaccess/source/core/api/RowSet.cxx#L839 - https://github.com/LibreOffice/core/blob/master/dbaccess/source/core/api/RowSetCache.cxx#L1261 - https://github.com/LibreOffice/core/blob/master/dbaccess/source/core/api/WrappedResultSet.cxx#L81 - https://github.com/LibreOffice/core/blob/master/dbaccess/source/core/api/resultset.cxx#L927 When performing an positioned insert on a ResultSet not supporting the XRowLocate interface, the following calls are made by Base: - https://github.com/LibreOffice/core/blob/master/dbaccess/source/core/api/RowSet.cxx#L839 - https://github.com/LibreOffice/core/blob/master/dbaccess/source/core/api/RowSetCache.cxx#L1261 - https://github.com/LibreOffice/core/blob/master/dbaccess/source/core/api/KeySet.cxx#L585
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?
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.