digiKam
dbengineerrorhandler.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2010-04-02
7  * Description : Database engine low level error handler
8  *
9  * Copyright (C) 2009-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2010-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_DB_ENGINE_ERROR_HANDLER_H
26 #define DIGIKAM_DB_ENGINE_ERROR_HANDLER_H
27 
28 // Qt includes
29 
30 #include <QObject>
31 #include <QMetaType>
32 #include <QSqlError>
33 
34 // Local includes
35 
36 #include "digikam_export.h"
37 
38 namespace Digikam
39 {
40 
41 class DIGIKAM_EXPORT DbEngineErrorAnswer
42 {
43 
44 public:
45 
46  DbEngineErrorAnswer() = default;
47  virtual ~DbEngineErrorAnswer() = default;
48 
49  virtual void connectionErrorContinueQueries() = 0;
50  virtual void connectionErrorAbortQueries() = 0;
51 
52 private:
53 
54  Q_DISABLE_COPY(DbEngineErrorAnswer)
55 };
56 
57 // -----------------------------------------------------------------
58 
59 class DIGIKAM_EXPORT DbEngineErrorHandler : public QObject
60 {
61  Q_OBJECT
62 
63 public:
64 
65  explicit DbEngineErrorHandler();
66  ~DbEngineErrorHandler() override;
67 
68 public Q_SLOTS:
69 
70  // NOTE: These all need to be slots, possibly called by queued connection
71 
82  virtual void connectionError(DbEngineErrorAnswer* answer,
83  const QSqlError& error,
84  const QString& query) = 0;
85 
96  const QSqlError& error,
97  const QString& query) = 0;
98 
99 private:
100 
101  // Disable
102  DbEngineErrorHandler(QObject*) = delete;
103 };
104 
105 } // namespace Digikam
106 
107 Q_DECLARE_METATYPE(Digikam::DbEngineErrorAnswer*)
108 
109 #endif // DIGIKAM_DB_ENGINE_ERROR_HANDLER_H
Definition: dbengineerrorhandler.h:42
virtual void connectionErrorAbortQueries()=0
virtual void connectionErrorContinueQueries()=0
virtual ~DbEngineErrorAnswer()=default
Definition: dbengineerrorhandler.h:60
virtual void consultUserForError(DbEngineErrorAnswer *answer, const QSqlError &error, const QString &query)=0
virtual void connectionError(DbEngineErrorAnswer *answer, const QSqlError &error, const QString &query)=0
Definition: datefolderview.cpp:43