[SailfishDevel] Recommended way to populate a LocalStorageDB from an external source

christopher.lamb at thurweb.ch christopher.lamb at thurweb.ch
Mon Feb 3 18:20:33 UTC 2014


Hi All

An architectural question: What is the the recommended approach (and  
harbour friendly way) to populate a LocalStorageDB on the Jolla with  
data from an external source?

Some background to the question:

My app Landed depends on a LocalStorageDB. It was always clear to me  
that Landed would be a readonly client of the DB, and the business of  
populating the DB would fall to "something else". Until recently that  
something else was a companion app LandedSettings.

But I was never happy with that solution, and it now seems to me that  
a Qt Desktop app would be much better suited to configuring /  
populating the DB. (more screen, better keyboard etc.).

This raises the question: How best to transfer the data populated in  
the Desktop app to the DB on the Jolla?

The Jolla's Documents folder (or a sub directory thereof) could  
clearly be used as as staging area. This is the approach that Wim  
takes with his Harbour-approved Checklists app.

But exactly how should this work? I see several possibilities, all  
with pros and cons.

a) The Desktop app creates a LocalStorageDB, and the entire DB is  
transferred to the Jolla. This means that Landed would have to deploy  
the DB on a file level, then access it via the LocalStorage api as  
normal.

b) The Desktop app dumps a human readable exchange file (csv, xml,  
json) which is picked up by Landed, parsed and converted to SQL  
INSERTS then called via the LocalStorage API

c) The Desktop app dumps an SQL script (a list of INSERT INTO  
statements) which Landed then executes

d) The Desktop app dumps an SQL script in the form of a javascript  
file, which is then dynamically loaded by Landed using dynamic QML

e) something I have not thought of ...

As further background, I tend to favour QML over C++, but use the  
latter where necessary (and am beginning to feel uncomfortably  
comfortable in that language ...).

I am aware that for any kind of file manipulation from QML I will  
probably have to resort to a C++ plugin. (Even this  
http://www.developer.nokia.com/community/wiki/Reading_and_writing_files_in_QML  
example from Nokia which sets out to provide file access without a  
plugin describes an implementation that is to my mind a c++ plugin!)

At the moment I favour option b) as the most likely to work and be  
accepted, with option d) as the wildcard probably wont't work, but  
might turn out to be the easy option.

Thanks in advance for your thoughts,

Chris








More information about the Devel mailing list