Using SQLite in QML - How to persist data on application shutdown
-
Hi, I am able to create a sql lite database connection, create tables and add data to the tables via javascript. Problem is on application shutdown the data is not persisted to a file. Is it even possible to persist for future application starts and restarts, or is the sql data file deleted on application shut down?
Thanks
-
I'm not sure I understand.
Are you using the QtQuick.LocalStorage import? Or are you writing your own adapter / C++ object which does the sqlite storage and exposes API to QML?If the former, and there is a specific bug with the way that persisted data is not available after application restart, then please file a bug with a minimal test case, in the Qt Project JIRA.
If the latter, then most likely there's a bug in your adapter (eg, you might not be committing the changes that you've written or something, and so the updates are being lost when you close your application, because they haven't been persisted to disc).
Cheers,
Chris. -
Take a look at this: http://www.developer.nokia.com/Community/Wiki/How-to_create_a_persistent_settings_database_in_Qt_Quick_(QML) It might be what you're looking for.