Use QSqlError::databaseText for reporting errors from SQLite wrapper to match SQLite3 error messages

This commit is contained in:
Asheem Mamoowala
2018-08-21 15:35:00 -07:00
parent fcab3a81cd
commit bc806d4354

View File

@@ -27,9 +27,9 @@ void checkQueryError(const QSqlQuery& query) {
QSqlError lastError = query.lastError();
if (lastError.type() != QSqlError::NoError) {
#if QT_VERSION >= 0x050300
throw Exception { lastError.nativeErrorCode().toInt(), lastError.text().toStdString() };
throw Exception { lastError.nativeErrorCode().toInt(), lastError.databaseText().toStdString() };
#else
throw Exception { lastError.number(), lastError.text().toStdString() };
throw Exception { lastError.number(), lastError.databaseText().toStdString() };
#endif
}
}
@@ -38,9 +38,9 @@ void checkDatabaseError(const QSqlDatabase &db) {
QSqlError lastError = db.lastError();
if (lastError.type() != QSqlError::NoError) {
#if QT_VERSION >= 0x050300
throw Exception { lastError.nativeErrorCode().toInt(), lastError.text().toStdString() };
throw Exception { lastError.nativeErrorCode().toInt(), lastError.databaseText().toStdString() };
#else
throw Exception { lastError.number(), lastError.text().toStdString() };
throw Exception { lastError.number(), lastError.databaseText().toStdString() };
#endif
}
}