Akonadi

dbconfigpostgresql.h
1 /*
2  Copyright (c) 2010 Tobias Koenig <[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 DBCONFIGPOSTGRESQL_H
21 #define DBCONFIGPOSTGRESQL_H
22 
23 #include "dbconfig.h"
24 
25 #include <optional>
26 
27 namespace Akonadi
28 {
29 namespace Server
30 {
31 
32 class DbConfigPostgresql : public DbConfig
33 {
34 public:
35  DbConfigPostgresql();
36 
40  QString driverName() const override;
41 
45  QString databaseName() const override;
46 
54  bool init(QSettings &settings) override;
55 
60  void apply(QSqlDatabase &database) override;
61 
65  bool useInternalServer() const override;
66 
70  bool startInternalServer() override;
71 
75  void stopInternalServer() override;
76 
77 protected:
78  QStringList postgresSearchPaths(const QString &versionedPath) const;
79 
80 private:
81  struct Versions {
82  int clusterVersion = 0;
83  int pgServerVersion = 0;
84  };
85  std::optional<Versions> checkPgVersion() const;
86  bool upgradeCluster(int clusterVersion);
87  bool runInitDb(const QString &dbDataPath);
88 
89  bool checkServerIsRunning();
90 
91  QString mDatabaseName;
92  QString mHostName;
93  int mHostPort;
94  QString mUserName;
95  QString mPassword;
96  QString mConnectionOptions;
97  QString mServerPath;
98  QString mInitDbPath;
99  QString mPgData;
100  QString mPgUpgradePath;
101  bool mInternalServer;
102 };
103 
104 } // namespace Server
105 } // namespace Akonadi
106 
107 #endif
QCA_EXPORT void init()
Helper integration between Akonadi and Qt.
KGuiItem apply()
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Jun 2 2020 23:09:07 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.