File indexing completed on 2025-01-05 04:46:57

0001 /*
0002     SPDX-FileCopyrightText: 2012 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "dbexception.h"
0008 
0009 #include <QSqlError>
0010 #include <QSqlQuery>
0011 
0012 using namespace Akonadi::Server;
0013 
0014 DbException::DbException(const QSqlQuery &query, const char *what)
0015     : Exception(what)
0016 {
0017     mWhat += "\nSql error: " + query.lastError().text().toUtf8();
0018     mWhat += "\nQuery: " + query.lastQuery().toUtf8();
0019 }
0020 
0021 const char *DbException::type() const throw()
0022 {
0023     return "Database Exception";
0024 }
0025 
0026 DbDeadlockException::DbDeadlockException(const QSqlQuery &query)
0027     : DbException(query, "Database deadlock, unsuccessful after multiple retries")
0028 {
0029 }