Akonadi

dbupdater.h
1 /*
2  Copyright (c) 2007 Volker Krause <[email protected]>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #ifndef AKONADI_DBUPDATER_H
21 #define AKONADI_DBUPDATER_H
22 
23 #include <QObject>
24 #include <QMap>
25 #include <QStringList>
26 #include <QSqlDatabase>
27 
28 class QDomElement;
29 class DbUpdaterTest;
30 
31 namespace Akonadi
32 {
33 namespace Server
34 {
35 
39 class UpdateSet
40 {
41 public:
42  typedef QMap<int, UpdateSet> Map;
43 
44  UpdateSet()
45  : version(-1)
46  , abortOnFailure(false)
47  , complex(false)
48  {
49  }
50 
51  int version;
52  bool abortOnFailure;
53  QStringList statements;
54  bool complex;
55 };
56 
60 class DbUpdater : public QObject
61 {
62  Q_OBJECT
63 
64 public:
71  DbUpdater(const QSqlDatabase &database, const QString &filename);
72 
77  bool run();
78 
79 private Q_SLOTS:
80  bool complexUpdate_25();
81  bool complexUpdate_36();
82 
83 private:
84  friend class ::DbUpdaterTest;
85 
86  bool updateApplicable(const QString &backends) const;
87  QString buildRawSqlStatement(const QDomElement &element) const;
88 
89  bool parseUpdateSets(int, UpdateSet::Map &updates) const;
90 
91  QSqlDatabase m_database;
92  QString m_filename;
93 };
94 
95 } // namespace Server
96 } // namespace Akonadi
97 
98 #endif
Updates the database schema.
Definition: dbupdater.h:60
A helper class that contains an update set.
Definition: dbupdater.h:39
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 30 2020 22:46:07 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.