QSqlite 多线程操作导致数据库锁死
Unsolved
Chinese
-
我在子线程里通过QSqlquery写 sqlite 数据库,主线程使用其他连接通过QSqlTableModel展示数据,当数据超过300条左右时,子线程的写操作总是提示 QSqlError(“5“, “Unable to fetch row“, “database is locked“),也使用了query.finish(),和while (model->canFetchMore())
model->fetchMore();
model->select();
model->query().finish();等操作,但不管用,有什么方法吗, -
@Feng-chunX
database is locked
=> "happens only when there is another connection with an active transaction"
You have another process or another thread which is writing to the database?
Google:qsqlquery "database is locked"