Akonadi

dbupdater.h
1/*
2 SPDX-FileCopyrightText: 2007 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QMap>
10#include <QObject>
11#include <QSqlDatabase>
12#include <QStringList>
13
14class QDomElement;
15class DbUpdaterTest;
16
17namespace Akonadi
18{
19namespace Server
20{
21/**
22 * @short A helper class that contains an update set.
23 */
25{
26public:
28
29 UpdateSet()
30 : version(-1)
31 , abortOnFailure(false)
32 , complex(false)
33 {
34 }
35
36 int version;
37 bool abortOnFailure;
38 QStringList statements;
39 bool complex;
40};
41
42/**
43 Updates the database schema.
44*/
45class DbUpdater : public QObject
46{
48
49public:
50 /**
51 * Creates a new database updates.
52 *
53 * @param database The reference to the database.
54 * @param filename The file containing the update descriptions.
55 */
56 DbUpdater(const QSqlDatabase &database, const QString &filename);
57
58 /**
59 * Starts the update process.
60 * On success true is returned, false otherwise.
61 */
62 bool run();
63
64private Q_SLOTS:
65 bool complexUpdate_25();
66 bool complexUpdate_36();
67
68private:
69 friend class ::DbUpdaterTest;
70
71 bool updateApplicable(const QString &backends) const;
72 QString buildRawSqlStatement(const QDomElement &element) const;
73
74 bool parseUpdateSets(int, UpdateSet::Map &updates) const;
75
76 QSqlDatabase m_database;
77 QString m_filename;
78};
79
80} // namespace Server
81} // namespace Akonadi
Updates the database schema.
Definition dbupdater.h:46
DbUpdater(const QSqlDatabase &database, const QString &filename)
Creates a new database updates.
Definition dbupdater.cpp:37
bool run()
Starts the update process.
Definition dbupdater.cpp:43
A helper class that contains an update set.
Definition dbupdater.h:25
Helper integration between Akonadi and Qt.
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:31:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.