[Libreoffice-bugs] [Bug 51780] New: default to Firebird not HSQLDB in Base

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Jul 6 12:54:07 CEST 2012


https://bugs.freedesktop.org/show_bug.cgi?id=51780

             Bug #: 51780
           Summary: default to Firebird not HSQLDB in Base
    Classification: Unclassified
           Product: LibreOffice
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: medium
         Component: Database
        AssignedTo: libreoffice-bugs at lists.freedesktop.org
        ReportedBy: lionel at mamane.lu
                CC: afriza.na at gmail.com, bjoern.michaelsen at canonical.com,
                    gleppert at gmx.de, lionel at mamane.lu,
                    mark at foresightlinux.org, michael.meeks at novell.com,
                    serval2412 at yahoo.fr
        Depends on: 38811


+++ This bug was initially created as a clone of Bug #38811 +++

Background: currently when creating an embedded database we default to the
Java-based HSQLDB database engine. That is somewhat unfortunate. It would be
better to default to an embedded FireBird provider - unfortunately we don't
have one. So - it needs writing - and then the default changing. See
[http://www.sqlite.org/c3ref/intro.html The SQLite C/C++ Interface].

Resources on the Firebird side:
Embedding:

http://www.firebirdsql.org/file/documentation/reference_manuals/user_manuals/html/qsg25-classic-or-super.html
 http://www.firebirdsql.org/manual/ufb-cs-embedded.html

http://www.firebirdsql.org/file/documentation/reference_manuals/user_manuals/html/qsg25-databases.html#qsg25-databases-connstrings-local
SQL Language:

http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25.html
API:
 examples/api in the FireBird sources
 sources of isql-fb program
 ...

Grr... It says
(http://www.firebirdsql.org/manual/ufb-cs-embedded.html#ufb-cs-embedded-linux)

 Finally, you can't just ship libfbembed.so with your application and
 use it to connect to local databases. Under Linux, you always need a
 properly installed server, be it Classic or Super.

That could be a problem, depending on what "a properly installed server" is.
Can we just ship it in LIBROFFICE_ROOT/program/fbserver? Or will it want config
files in /etc/ and that kind of things? To be investigated.

With HSQLDB, we override its "access to files" class so that it writes directly
into our in-memory and on-disk ZIP file structure (.odb file). Can we do
something similar with FireBird or will we have to use temporary files that are
copied into the .odb file at each .odb "file save" operation? In the latter
case, how to detect those have changed and activate the "file save" icon?

Resources on the LibreOffice side:

OpenOffice.org Developer's Guide at
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OpenOffice.org_Developers_Guide,
and in particular these sections:

 * Writing Database Drivers:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Database/Writing_Database_Drivers
 * About UNO:

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Professional_UNO

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Writing_UNO_Components

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/AdvUNO/Advanced_UNO


There is also a driver skeleton  in the SDK
documentation, and it has a file named "How_to_write_my_own_driver.txt" with a
more hands-on approach than the Developer's Guide, which gives more a
high-level overview and reference. In a git checkout of the source tree, it is
in odk/examples/DevelopersGuide/Database/DriverSkeleton

Also gleaned:

 * http://help.libreoffice.org/Common/Integrating_new_UNO_components

> * What classes/services/interfaces at a minimum have to be implemented?

See
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Database/SDBC_Driver
for a functional minimum. After, you can add SDBCX services which provide added
features.

> * Are the code skeletons for the drivers usually auto-generated or written by
> hand?

The Database Driver Skeleton in the SDK seems to be written by hand, as it is
"as is" in the git sources.

> * Are there any existing unit tests for testing Base functionality with new
> drivers? If not, how were the existing drivers tested?

We currently don't have any, but that would be a fantastic opportunity to add
some :)

> * (a simple one) How will I set the default driver to SQLite in the source
> code?

Chase for "embedded" (and especially EMBEDDED_HSQLDB) in connectivity and
dbaccess directories of the source tree. That's the points where it currently
does something "special" for embedded HSQLDB, and where you'll have to do
something similar for embedded SQLite DB.



Let me introduce myself. I've started taking care of the PostgreSQL driver for
LibreOffice. That was also my first sizeable contribution to LibreOffice. As
such, I think:

 - I can be useful for you in the "bootstrap" phase sharing the things I
   learned while doing the PostgreSQL driver.

 - It would be useful for both us if we stayed in touch and shared
   experiences / what we learn with each other.

I was rather lucky in that there was a "basically working / beta quality"
driver for PostgreSQL for OpenOffice.org already, that was actively used in
Debian&Ubuntu, and I basically handled bitrot (updating it to new OO.org /
Libreoffice version) and added a few "easy" features and optimisations I liked
or wanted.

For FireBird, you'll have to start from scratch.

As to PostgreSQL-specific knowledge (like "how to list a table's columns and
their datatype"), I've found it useful to just look at how the ODBC and JDBC
driver do things, and how the "psql" command-line interface program does
things. For that, you could use the sources of the ODBC, JDBC, .NET, Python,
C++ drivers/wrappers.

Actually, maybe using the C++ wrapper could be efficient; to be investigated.


One last thing: once you have decided to do this, put the bug's status to
"ASSIGNED" and put yourself into "assigned to". If you change your mind in
future and move to other things, put the bug back in "NEW" state and "reset
assignee to default".

Welcome to the community and happy hacking!

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Libreoffice-bugs mailing list