hsqldb bits ...

Michael Meeks michael.meeks at suse.com
Mon Jun 10 01:47:29 PDT 2013

Hi Andrzej,

	I append some random code pointers / notes on hsqldb. In -theory- this
should be easy, since hsqldb by defualt stores it's data in a SQL dump - however
LibreOffice switched to an "optimised" binary store.

	That leaves the table formats as SQL - which we will need to import first,
and then introspect the produced tables (I suspect) in order to decode the binary
format. We need to use the parsed table / type information from that
import to walk the binary dump of the database: I don't think it's going
to be too difficult with a few unit tests about the place :-)

	I attach my (un-commented) and random code pointers from when I last
looked into doing that.

	Hope it helps :-)


michael.meeks at suse.com  <><, Pseudo Engineer, itinerant idiot
-------------- next part --------------

"Storage" property.

                aProperties.put( "storage_class_name",
                    ::rtl::OUString(  "com.sun.star.sdbcx.comp.hsqldb.StorageAccess"  ) );
                aProperties.put( "fileaccess_class_name",
                    ::rtl::OUString(  "com.sun.star.sdbcx.comp.hsqldb.StorageFileAccess"  ) );


                // JDBC driver and driver's classpath
                aProperties.put( "JavaDriverClass",
                    ::rtl::OUString(  "org.hsqldb.jdbcDriver"  ) );
                aProperties.put( "JavaDriverClassPath",
                        " vnd.sun.star.expand:$BRAND_BASE_DIR/program/classes/sdbc_hsqldb.jar"
                        " vnd.sun.star.expand:$BRAND_BASE_DIR/program/classes/sdbc_hsqldb.jar"
                        ) );

		+ loads properties.

                ::rtl::OUString sConnPartURL = sSystemPath.copy( 0, ::std::max< sal_Int32 >( nIndex, sSystemPath.getLength() ) );
                ::rtl::OUString sKey = StorageContainer::registerStorage( xStorage, sConnPartURL );
                aProperties.put( "storage_key", sKey );
                aProperties.put( "storage_class_name",
                    ::rtl::OUString(  "com.sun.star.sdbcx.comp.hsqldb.StorageAccess"  ) );
                aProperties.put( "fileaccess_class_name",
                    ::rtl::OUString(  "com.sun.star.sdbcx.comp.hsqldb.StorageFileAccess"  ) );

	+ so URL -> xStorage mapping ...

src/org/hsqldb/persist/DataFileCache.java:    protected String   backupFileName;
src/org/hsqldb/persist/DataFileCache.java:    // this flag is used externally to determine if a backup is required
src/org/hsqldb/persist/DataFileCache.java:        backupFileName = baseFileName + ".backup";
src/org/hsqldb/persist/DataFileCache.java:     *  without backup.
src/org/hsqldb/persist/DataFileCache.java:                fa.removeElement(backupFileName);
src/org/hsqldb/persist/DataFileCache.java:            backupFile();
src/org/hsqldb/persist/DataFileCache.java:     *  Saves the *.data file as compressed *.backup.
src/org/hsqldb/persist/DataFileCache.java:    void backupFile() throws IOException {
src/org/hsqldb/persist/DataFileCache.java:                ZipUnzipFile.compressFile(fileName, backupFileName + ".new",
src/org/hsqldb/persist/DataFileCache.java:        if (fa.isStreamElement(backupFileName + ".new")) {
src/org/hsqldb/persist/DataFileCache.java:            fa.removeElement(backupFileName);
src/org/hsqldb/persist/DataFileCache.java:            fa.renameElement(backupFileName + ".new", backupFileName);
src/org/hsqldb/persist/DataFileCache.java:        fa.removeElement(backupFileName);
src/org/hsqldb/persist/LockFile.java:            // safely checkpoint, backup and/or shut down that instance?  For
src/org/hsqldb/persist/LockFile.java:            // backup location using a globally unique file name and then do a

Stream file in ScaledRAFile.java ...

	+ writeDate, writeTime 

    public Object[] readData(int[] colTypes)
    throws IOException, HsqlException {

More information about the LibreOffice mailing list