Re: [Evolution-hackers] Contacts database modifications history



On Wed, 2014-04-23 at 16:08 -0400, Tristan Van Berkom wrote:
This is my prerogative and I can accept that it is not shared with the
maintainers of EDS, nevertheless I would still like to caution against
opening up the SQL tables owned by EBookSqlite to be shared with
plugins (it may take a little more time in the beginning to flesh out
a well defined interactive API that satisfies the needs of plugins,
but this will pay off in better long term stability, anyway this is my opinion).

I agree with you, plugins should not make assumptions about the content of
sqlite database. This needs to be documented clearly.

However, the goal is not to let plugins access the existing tables.
Instead, the goal is to let plugins create their own custom tables and update
them as part of the same transaction that EBookSqlite uses to update its own
tables. Name clashes need to be avoided, but that is a minor issue. We might
also want to add hooks for DB updates and locale changes.
I think that we can still create solution where internal tables from EBookSqlite will be protected from 
accessing from plugins and all queries will be run in the same transaction (which is most important part for 
us).
Shared transaction across databases may be possible by using sqlite ATTACH command. Plugins can create their 
own databases and ask EBookSqlite to attach them to the one used by EBookSqlite, providing some names that 
will identify them (this name will have to be prepended to each table name when making query). The only 
problem may be that each query from module need to be made using sqlite context from EBookSqlite (the one 
which called ATTACH), but EBookSqlite may provide some generic function to make query on behalf of given 
module and check if this query should be allowed (it will check if module doesn't try to access tables that 
it shouldn't i.e. if tables names are prepended correctly - this may be the tricky part).

What do you think about such approach ?

Bye,
Mateusz




Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]