Hi Mohsin,

        Of course, https://bugs.freedesktop.org/show_bug.cgi?id=38811 is a
great place for some pointers on this topic; but I prefer E-mail for its
friendliness and ease; so - first, welcome !

On Tue, 2011-11-22 at 19:10 +1100, Mohsin Mansur wrote:
> I am interested in writing the SQLite driver code for Base. 

        It's a key piece we need working on, so you're much appreciated.

> * What classes/services/interfaces at a minimum have to be
> implemented? I browsed through the drivers tree and it appears that
> not all drivers implement all services (except for some basic ones
> such as tables and columns). How does one decide what to implement and
> what not to implement?

        I guess starting with the most minimal one you can find ;-) I imagine
something like the evolution connector might show something like that.
As/when something works grow it I guess.

> * Are the code skeletons for the drivers usually auto-generated or
> written by hand ? There is some documentation for generating code
> skeletons from UNOIDL files on the LibreOffice SDK API page but I
> don't know if that's relevant to this case or not (once again, driver
> developers can let me know what they did).

        That is certainly possible. It seems sub-classing the sdbc base-classes
is the way to go to implement most of the UNO interfaces you need.

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

        I strongly suspect the answer is 'no' :-) one of the reasons we want an
sqlite database backend present in the build is in order to be able to
have fast, during-compile unit testing of 'base' so ...

        Often there are useful things in the workben/ directory that, while not
unit tests, may help. eg.
connectivity/workben/skeleton/how_to_write_a_driver.txt - of course
these tend to be somewhat outdated as well (as a bonus).

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

        That is a good question too. So this should prolly done by UNO service
names; you can see the service names in:

        connectivity/source/drivers/hsqldb/hsqldb.component

        a quick git grep for them reveals that this is not how it is done ;-)

        dbaccess/source/core/misc/dsntypes.cxx

        has a URL scheme, with this:

::rtl::OUString ODsnTypeCollection::getEmbeddedDatabase() const
{
    ::rtl::OUString sEmbeddedDatabaseURL;
    static const ::rtl::OUString 
s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess")); 
///Installed
    const ::utl::OConfigurationTreeRoot aInstalled = 
::utl::OConfigurationTreeRoot::createWithServiceFactory(m_xFactory, 
s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
    if ( aInstalled.isValid() )
    {
        if ( 
aInstalled.hasByName("EmbeddedDatabases/DefaultEmbeddedDatabase/Value") )
        {
            static const ::rtl::OUString 
s_sValue(RTL_CONSTASCII_USTRINGPARAM("EmbeddedDatabases/DefaultEmbeddedDatabase/Value"));

            aInstalled.getNodeValue(s_sValue) >>= sEmbeddedDatabaseURL;
            if ( sEmbeddedDatabaseURL.getLength() )
                aInstalled.getNodeValue(s_sValue + 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sEmbeddedDatabaseURL + 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/URL"))) >>= sEmbeddedDatabaseURL;
        }
    }
    if ( !sEmbeddedDatabaseURL.getLength() )
        sEmbeddedDatabaseURL = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:embedded:hsqldb"));
    return sEmbeddedDatabaseURL;
}

        That looks like it might well be what you want; I'd compile that with
debug and/or an fprintf & step through it...

        I -assume- that there is some setting that can be set for this in the
UI, but perhaps this is a hidden setting.

        Hope that helps !

                Michael.

-- 
michael.me...@suse.com  <><, Pseudo Engineer, itinerant idiot

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to