One of the major motivations for my GSOC project this summer was to get rid of the somewhat inefficient use of Java from C++. One immediate difference noticeable from early on when working on Firebird integration is the disappearance of a large pause when loading a database caused by startup of the jvm. (Unfortunately we still need Java for various wizards within Base which still need rewriting in C++/Python/etc. — for now this pause just happens at a different point in time.)
However the main speedup to be expected was in actual manipulation of data. Hence a insertion/retrieval test was developed — currently we only test the insertion and retrieval of 120’000 strings (a dump of the aspell dictionary), the results of which show a significant advantage for Firebird:
It should be noted that this test is not an accurate comparison of Firebird and HSQLDB in their native environments, this is only an accurate comparison of the two databases accessed via SDBC drivers, i.e. going via C++ — I suspect the slowness of HSQLDB is mostly due to the use of JNI and the C++/Java transition.
It would probably be interesting to add further tests to compare the performance when working with numeric types, however the performance boost of using firebird should already be clear. The tests and documentation can currently be found in dbaccess/qa/unit/emeddeddb_performancetests.cxx.
It’s now possible to select the driver to use for embedded databases within Base thanks to the new selector:
The default database remains HSQLDB, however this change allows easy creation of new firebird based .odb files (mainly for testing purposes at the moment), whereas previously manual extraction and editing of the .odb file was necessary to create such a file. This also means that in future, once the default database can be changed to Firebird, it will still be possible to create HSQLDB files for compatibility with older version of LO/OO/etc.
After spending some time trying to figure out why firebird didn’t like quoted identifiers I discovered that I had missed that the database supports multiple sql “dialects” (quoted identifiers are needed e.g. in ‘CREATE TABLE “aTableName”….’ — Base uses quoted identifiers everywhere in fact — previously quotation marks were replaced with spaces which was a somewhat ugly/wrong solution to the problem). These dialects are:
- 1: The original dialect for IB5.5 and earlier which doesn’t supported quote identifiers, the various sql date/time types etc.
- 3: The dialect for IB6 and newer which supports quoted identifiers, various sql date/time types etc.
Previously dialect 1 had been in use, and I had no clue that this was the issue. As part of the journey towards discovering this I did however manage to add support for passing usernames/password to firebird (although this is unused so far — remote db support still needs to be added, but only really involves parsing a connection string — embedded dbs are accessed without usernames and passwords), some of the database metadata definitions were also cleaned up/implemented.
In other news, the sdbc driver can now list the names of all the columns in a table except for the first column. It doesn’t seem to be an off-by-one error as the methods to get column names are all called and return data as expected — but it definitely is a bug somewhere in the driver.
Firebird has now been integrated into LibreOffice master!
It now builds on Mac and Windows in addition to Linux. (I’ve only tested on Linux but will be testing/fixing as necessary on Mac/Windows this week.)
The database driver itself is almost unusable at the moment as I’ve been refactoring various things to do with transaction control and execution of statements. More and more functionality should be appearing in the course of this week, making the driver more usable .
For now hsqldb will still be the default embedded db. To use firebird for embedded files you either have to set EmbeddedDatabases/DefaultEmbeddedDatabase/Value in the registry to “sdbc:embedded:firebird”; or create a new .odb file with base, edit the content.xml within and replace “sdbc:embedded:hsqldb” with “sdbc:embedded:firebird”, then reopen the .odb. At the moment the driver can only work with databases embedded in the .odb; support for external and/or remote databases however doesn’t look particularly complicated so should hopefully appear soon.
The embedded firebird driver can now create new .odb’s using firebird, and open and save existing files — when running the firebird db is stored in a temporary file, this is copied into the .odb file every time it is saved — and extracted as necessary on startup. The sdbc driver is still somewhat incomplete meaning that this isn’t particularly usable yet, however in principle LO can now use Firebird as it’s embedded Database. This means I can now work on the actual sdbc driver!
Currently it is only usable on Linux: Windows compiles but crashes — I’ll be setting up a debug build to run over the weekend meaning I should hopefully be able to debug at the beginning of next week. Mac is currently not buildable — it looks like fixing this shouldn’t be too difficult though, I’ve managed to obtain a mac which I’ll be setting up soon in order to work on this.
The sdbc driver won’t be exclusive to embedded firebird — it should eventually be able to also support external firebird database files, and even connect to remote firebird servers — this should be only a very small amount of work, mostly to do with the gui needed to set up a connection.
Things have been taking slighty longer than expected with the first stage of the Firebird integration project, I have however finally gotten Firebird building within LibreOffice both on Linux and Windows (Mac OS still to be tested).
Firebird (2.5) is officially only supported using MSVS 7 or 8 on Windows, however LibreOffice should support 10 (2010) or 11 (2011), hence I had to do some work patching Firebird to compile within the LibreOffice build system. This now works and LibreOffice build successfully — unfortunately the sdbc driver itself now crashes on Windows, which will need fixing.
I’m now starting to look at the SDBC driver itself (which Javier Fernandez and Andres Gomez of Igalia originally started writing) as well as looking at how to have the firebird db stored within the .odb file itself (the driver currently assumes a db in a temp. directory). Whereas HSQLDB writes directly to the .odb, for Firebird — at least initially — the database file will be stored externally and extracted from / written into the .odb file as appropriate. Ideally the driver would be able to deal both with having a completely separate db file, and having the db within the .odb — it looks like this should not be particularly difficult to implement.
Yesterday I found out that I’d been accepted into the Google Summer of Code 2013 to work on LibreOffice! Many thanks to the Mentors for accepting me!
My project involves implementing an SDBC driver for the Firbird SQL Database for LO Base, with a view to having this replace the current default of HSQLDB, which depends on Java, meaning that Java could the eventually be removed as a fixed dependency for full LibreOffice functionality. Further to this I’d also be looking at migratiom of files from HSQLDB to Firebird, and also implementing some unit tests for the database functionality, something that has been previously been missing from LO Base. (Currently .odb files use HSQLDB for their internal database, although it is also possible to use other external databases — this connector would mean that future .odb files would use Firebird internally.) There are a number of other developers who are also working on this at the moment, meaning development should be fast and exciting!
I’m currently concentrating on exams which finish at the end of the next week, after which I’ll be free to work on this full time. I’ll also be continuing with the Firefox OS Impress Remote which I started work on some time ago (but this will be completely independent of the GSOC). I now have a Firefox Phone meaning I can get on to testing things on actual hardware, and have also been doing some experimentation on implementing the UI using jQuery mobile, meaning something testable/usable isn’t too far away.
Continuing on from my GSOC project last year, there are two fellow students working on the Impress Remote this summer: Artur Dryomov will be working improving the Impress Remote / Current app, Siqi Liu will be working on an iOS version of the remote app.
The LibreOffice Find Bar has gained “Match Case” and “Find All” buttons to match the functionality of it’s Firefox Equivalent:
The “Match Case” checkbox has made it into 4.1, I’m not sure whether the “Find All” will make it as it was created after the deadline for including new features in 4.1.
I’m also working on a slight bug affecting the up/down search in the find bar where the search “gets stuck” when changing search direction.
I’ve started working on a version of the Impress Remote for Firefox OS. It currently only supports using TCP (i.e. Wifi or wired network), I’m going to start working on adding Bluetooth support once I get hold of some suitable hardware, probably later this month.
Most of the backend has been done, and a basic app exists:
I’m now starting to work on a proper User Interface which will be based on that of the Android Impress Remote.
More good news: the Libreoffice Design Team has come up with a first prototype icon for the remote (I hear they are working on further versions) — here’s a screenshot in context:
Most of the development recently has been on improving the general reliability, stability and usability of the app. It’s looking highly likely that the first official release will be as part of Libreoffice 3.7 which arrives in November.