Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.1.0 , 5.1.1, 5.2.0 Beta1
-
Windows 7
Description
New Sqlite version updated to Qt 5.1.0 opens read only files very slowly:
qtbase/src/3rdparty/sqlite/sqlite3.h
#define SQLITE_VERSION "3.7.17"
#define SQLITE_VERSION_NUMBER 3007017
There's no issue with Qt 5.0 and Qt 4.8 which has older Sqlite:
qtbase/src/3rdparty/sqlite/sqlite3.h
#define SQLITE_VERSION "3.7.7.1"
#define SQLITE_VERSION_NUMBER 3007007
To reproduce run code below. Then set created test.db.sqlite file to read-only and run code again. See elapsed time in debug. For me it was ~1500ms for read-only file and 0-1ms for writable file with Sqlite 3.7.17. I build older sqlite from Qt 5.0 to Qt 5.1 and delay was gone.
main.cpp
#include <QApplication> #include <QSqlDatabase> #include <QElapsedTimer> #include <QDebug> int main(int argc, char *argv[]) { QApplication a(argc, argv); QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName("test.db.sqlite"); QElapsedTimer t; t.start(); if( db.open() ) { qint64 e = t.elapsed(); qDebug() << "elapsed: " << e << "ms"; } db.close(); return a.exec(); }