I have used SQLite on android to access a SQLite database from Qt's Local Storage API and the Android API. I thought the serialization mode would have worked, but I experienced numerous corruptions, despite closing all the cursors/handles apropriately. I eventually re-wrote everything to use Qt's API, and the corruption stopped. 
 
There may be other issues at play, but https://sqlite.org/faq.html questions 5 & 6 paint a more complicated picture. 
 
Sent: Wednesday, February 15, 2017 at 7:37 AM
From: "Łukasz Korbel" <lkor...@milosolutions.com>
To: development <development@qt-project.org>
Subject: [Development] Threads and the SQL Module
According to http://doc.qt.io/qt-5/threads-modules.html#threads-and-the-sql-module database connection should be used within one thread *only*.
 
I have checked SQLite driver and according to https://www.sqlite.org/threadsafe.html it supports multithreading by default. And it seems that Qt implementation does not restrict it (http://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp#n645). Code I'm working on is creating QSqlQuery for the same connection in different threads and it works.
 
I understand it doesn't mean Qt want or need to support such use case but maybe documentation
can be slightly more accurate? Right now it implies that database connection can never be used from different threads but it seem it depends more on particular driver/3rdparty lib.
 
 
Łukasz Korbel
Senior Software Developer
Email: lkor...@milosolutions.com
Skype: lukasz_korbel
Milo Solutions
www.milosolutions.com | Facebook | Twitter
Disclaimer: This e-mail and any attachments contain information that may be privileged or confidential and is the property of Milo Solutions. If you are not the intended recipient, please notify me immediately by replying to this e-mail, and then delete it. Any unauthorised dissemination, distribution, copying or use of this communication is strictly prohibited. The contents of an attachment to this e-mail may contain software viruses, which could damage your own computer system. Although this e-mail and any files attached to it may have been checked with virus detection software before transmission you should carry out your own virus checks before opening the attachment. No liability can be accepted for any damage which you may sustain as a result of software viruses.
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to