View Full Version : using sqlite3_busy_timeout() in Qt
ahmetturan
16th January 2014, 12:10
I set database:
QsqlDatabase db;
db = QsqlDatabase::addDatabase("QSQLITE");
But I can not find how can I use sqlite3_busy_timeout(sqlite3*, int ms) (http://www.sqlite.org/c3ref/busy_timeout.html) function in Qt.
anda_skoa
16th January 2014, 13:38
http://qt-project.org/doc/qt-4.8/qsqldriver.html#handle
Cheers,
_
ahmetturan
16th January 2014, 15:45
@anda_skoa thank you for your answer but I do not undestand how can I use the function?
handle () gives me sqlite3 object but how can I use the sqlite3_busy_timeout() function?
can you give an example?
anda_skoa
16th January 2014, 16:14
Not sure what you need an example for, the function seems to be quite simple to call
QVariant v = db.driver()->handle();
if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*") == 0) {
// v.data() returns a pointer to the handle
sqlite3 *handle = *static_cast<sqlite3 **>(v.data());
if (handle != 0) { // check that it is not NULL
sqlite3_busy_timeout(handle, 100);
}
}
Cheers,
_
ahmetturan
16th January 2014, 16:25
@anda_skoa I get it. thank you .
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.