# HG changeset patch # User Tom Fredrik Blenning Klaussen # Date 1381407181 -7200 # Node ID f507a7240bc9f11009a9672b607c1edbae921f68 # Parent 69a30d9f126e6613a6738097073df0b1e5d1b46c Functionality for easy clearing of a query when throwing an exception. diff -r 69a30d9f126e -r f507a7240bc9 Exception/SQLException.cpp --- a/Exception/SQLException.cpp Thu Oct 10 14:12:17 2013 +0200 +++ b/Exception/SQLException.cpp Thu Oct 10 14:13:01 2013 +0200 @@ -12,6 +12,13 @@ { } +SQLException::SQLException(QSqlQuery& errorQuery, bool clear) : + Exception(errorQuery.lastError().text() + ":" + errorQuery.lastQuery()) +{ + if (clear) + errorQuery.clear(); +} + void SQLException::raise() const { throw *this; diff -r 69a30d9f126e -r f507a7240bc9 Exception/SQLException.hpp --- a/Exception/SQLException.hpp Thu Oct 10 14:12:17 2013 +0200 +++ b/Exception/SQLException.hpp Thu Oct 10 14:13:01 2013 +0200 @@ -8,6 +8,7 @@ public: SQLException(const string_t& errMsg); SQLException(const QSqlQuery& error); + SQLException(QSqlQuery& error, bool clear); virtual void raise() const; };