Skip to content

Commit

Permalink
QSqlQuery sqlQuery = db.exec(query);
Browse files Browse the repository at this point in the history
  • Loading branch information
BourgeoisLab committed Oct 28, 2023
1 parent 272a6b1 commit c37c034
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions kleiner-brauhelfer-core/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,13 @@ void Database::discard()

QSqlQuery Database::sqlExec(const QSqlDatabase &db, const QString &query)
{
QSqlQuery sqlQuery = db.exec(query);
QSqlError error = db.lastError();
if (error.isValid())
QSqlQuery sqlQuery(db);
if (!sqlQuery.exec(query))
{
mLastError = error;
mLastError = db.lastError();
qCritical(Brauhelfer::loggingCategory) << query;
qCritical(Brauhelfer::loggingCategory) << error;
throw std::runtime_error(error.text().toStdString());
qCritical(Brauhelfer::loggingCategory) << mLastError;
throw std::runtime_error(mLastError.text().toStdString());
}
return sqlQuery;
}
Expand Down
2 changes: 1 addition & 1 deletion kleiner-brauhelfer-core/kleiner-brauhelfer-core.pro
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ VER_MAJ = 2
# Datenbankversion
VER_MIN = 9
# Patchversion
VER_PAT = 1
VER_PAT = 2

VERSION = $$sprintf("%1.%2.%3", $$VER_MAJ, $$VER_MIN, $$VER_PAT)
DEFINES += VER_MAJ=\"$$VER_MAJ\" VER_MIN=\"$$VER_MIN\" VER_PAT=\"$$VER_PAT\"
Expand Down

0 comments on commit c37c034

Please sign in to comment.