Bug 68675 - ODBC: support arbitrarily-sized bookmarks
Summary: ODBC: support arbitrarily-sized bookmarks
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
(earliest affected) Master
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Keywords: difficultyInteresting, easyHack, skillCpp, skillSql
Depends on:
Blocks: Database-Connectivity
  Show dependency treegraph
Reported: 2013-08-28 17:35 UTC by Lionel Elie Mamane
Modified: 2021-05-14 09:04 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:
Regression By:


Note You need to log in before you can comment on or make changes to this bug.
Description Lionel Elie Mamane 2013-08-28 17:35:29 UTC
Currently, LibreOffice allocates (in ODBC connections) a buffer of size 20 for bookmarks. This usually suffices, but there is no guarantee that it does.

The size is set in connectivity/source/drivers/odbcbase/OResultSet.cxx:

    const SQLLEN nMaxBookmarkLen = 20;

This should be changed to querying the maximal size at runtime with SQLColAttribute (called on column 0), and that's the size of the buffer we need.

Hopefully this will not trigger bugs in ODBC drivers... Maybe we should take the biggest of the value returned by SQLColAttribute and the current 20?
Comment 1 Terrence Enger 2013-09-12 14:19:10 UTC

Do you know a driver which uses longer bookmarks?  Perhaps a free driver?

Comment 2 Lionel Elie Mamane 2013-09-12 15:44:10 UTC
(In reply to comment #1)
> Do you know a driver which uses longer bookmarks?

No, I don't.
Comment 3 Alex Thurgood 2015-01-03 17:40:21 UTC Comment hidden (no-value)
Comment 4 Robinson Tryon (qubit) 2015-12-13 13:24:13 UTC Comment hidden (obsolete)
Comment 5 Robinson Tryon (qubit) 2016-02-18 14:51:41 UTC Comment hidden (obsolete)
Comment 6 Matt K 2021-05-14 06:58:15 UTC
Can you specify how to create these ODBC connections and how to view/create the bookmarks?
Comment 7 Lionel Elie Mamane 2021-05-14 08:18:43 UTC
(In reply to Matt K from comment #6)
> Can you specify how to create these ODBC connections

Create an ODBC data source (OS specific; windows: launch ODBC administrator; GNU/Linux: edit ~/.odbc.ini or use some GUI tool to do that)

libreoffice --base
(or from a running LibreOffice, menu file / new / database)

connect to an existing database
choose "ODBC" in the drop-down box

enter a valid ODBC data source configured on the system

next, etc

> and how to view/create the bookmarks?

They are not exposed in the UI; they are a feature of the programming API. Insofar as LibreOffice code itself uses ODBC bookmarks, this would also cause gui-user-visible bugs when operating on an ODBC source that makes bookmarks longer than 20 bytes.

open a result set (programmatically execute a query returning results)
stick in a variable, named e.g. rs

then something like:

Comment 8 Buovjaga 2021-05-14 09:04:23 UTC
This FAQ entry is helpful: https://wiki.documentfoundation.org/Faq/Base/021