读书人

sqlite 多线程编程解决思路

发布时间: 2013-08-01 15:23:18 作者: rapoo

sqlite 多线程编程
Qt下sqlite如何进行多线程编程,如何避免数据库死锁。 SQLite Qt
[解决办法]
Qt的数据连接不支持跨线程使用
在Assistant检索Thread-Support in Qt Modules
第一段话
Threads and the SQL Module

A connection can only be used from within the thread that created it. Moving connections between threads or creating queries from a different thread is not supported.

In addition, the third party libraries used by the QSqlDrivers can impose further restrictions on using the SQL Module in a multithreaded program. Consult the manual of your database client for more information
[解决办法]
对跨线程的数据读写,主动加锁保护。

读书人网 >QT开发

热点推荐