valueStrings << QString("%1=%2").arg(iter.key(), value);
}
qCritical() << " bound Values:" << qPrintable(valueStrings.join(", "));
- qCritical() << " Error Number:" << query.lastError().number();
+ qCritical() << " Error Code:" << qPrintable(query.lastError().nativeErrorCode());
qCritical() << " Error Message:" << qPrintable(query.lastError().text());
qCritical() << " Driver Message:" << qPrintable(query.lastError().driverText());
qCritical() << " DB Message:" << qPrintable(query.lastError().databaseText());
QList<QVariant> list = boundValues();
for (int i = 0; i < list.size(); ++i)
qWarning() << i << ": " << list.at(i).toString().toLatin1().data();
- qWarning() << " Error Number:" << lastError().number();
+ qWarning() << " Error Code:" << qPrintable(lastError().nativeErrorCode());
qWarning() << " Error Message:" << lastError().text();
}
lockForWrite();
safeExec(query);
if (query.lastError().isValid()
- && query.lastError().number() == 19) { // user already exists - sadly 19 seems to be the general constraint violation error...
+ && query.lastError().nativeErrorCode() == "19") { // user already exists - sadly 19 seems to be the general constraint violation error...
db.rollback();
}
else {
error = query.lastError().isValid();
// unexepcted error occured (19 == constraint violation)
- if (error && query.lastError().number() != 19) {
+ if (error && query.lastError().nativeErrorCode() != "19") {
watchQuery(query);
}
else {
if (logMessageQuery.lastError().isValid()) {
// constraint violation - must be NOT NULL constraint - probably the sender is missing...
- if (logMessageQuery.lastError().number() == 19) {
+ if (logMessageQuery.lastError().nativeErrorCode() == "19") {
QSqlQuery addSenderQuery(db);
addSenderQuery.prepare(queryString("insert_sender"));
addSenderQuery.bindValue(":sender", msg.sender());
if (!query.lastError().isValid())
return true;
- switch (query.lastError().number()) {
- case 5: // SQLITE_BUSY 5 /* The database file is locked */
- // fallthrough
- case 6: // SQLITE_LOCKED 6 /* A table in the database is locked */
+ QString nativeErrorCode = query.lastError().nativeErrorCode();
+
+ // SQLITE_BUSY 5 /* The database file is locked */
+ // SQLITE_LOCKED 6 /* A table in the database is locked */
+ if (nativeErrorCode == "5" || nativeErrorCode == "6") {
if (retryCount < _maxRetryCount)
return safeExec(query, retryCount + 1);
- break;
- default:
- ;
}
return false;
}