TrinityCore
Loading...
Searching...
No Matches
DBUpdater.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program 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 General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef DBUpdater_h__
19#define DBUpdater_h__
20
21#include "Define.h"
22#include "DatabaseEnvFwd.h"
23#include <stdexcept>
24#include <string>
25
26template <class T>
28
29namespace boost
30{
31 namespace filesystem
32 {
33 class path;
34 }
35}
36
37class TC_DATABASE_API UpdateException : public std::runtime_error
38{
39public:
40 using std::runtime_error::runtime_error;
41};
42
48
50{
51public:
52 static std::string GetCorrectedMySQLExecutable();
53
54 static bool CheckExecutable();
55
56private:
57 static std::string& corrected_path();
58};
59
60template <class T>
62{
63public:
64 using Path = boost::filesystem::path;
65
66 static inline std::string GetConfigEntry();
67
68 static inline std::string GetTableName();
69
70 static std::string GetBaseFile();
71
72 static bool IsEnabled(uint32 const updateMask);
73
74 static BaseLocation GetBaseLocationType();
75
76 static bool Create(DatabaseWorkerPool<T>& pool);
77
78 static bool Update(DatabaseWorkerPool<T>& pool);
79
80 static bool Populate(DatabaseWorkerPool<T>& pool);
81
82private:
83 static QueryResult Retrieve(DatabaseWorkerPool<T>& pool, std::string const& query);
84 static void Apply(DatabaseWorkerPool<T>& pool, std::string const& query);
85 static void ApplyFile(DatabaseWorkerPool<T>& pool, Path const& path);
86 static void ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& host, std::string const& user,
87 std::string const& password, std::string const& port_or_socket, std::string const& database, std::string const& ssl,
88 Path const& path);
89};
90
91#endif // DBUpdater_h__
BaseLocation
Definition DBUpdater.h:44
@ LOCATION_DOWNLOAD
Definition DBUpdater.h:46
@ LOCATION_REPOSITORY
Definition DBUpdater.h:45
std::shared_ptr< ResultSet > QueryResult
#define TC_DATABASE_API
Definition Define.h:111
uint32_t uint32
Definition Define.h:154
static std::string & corrected_path()
Definition DBUpdater.cpp:61
static bool CheckExecutable()
Definition DBUpdater.cpp:40
static std::string GetCorrectedMySQLExecutable()
Definition DBUpdater.cpp:32
boost::filesystem::path Path
Definition DBUpdater.h:64
static std::string GetBaseFile()
static std::string GetTableName()
static bool IsEnabled(uint32 const updateMask)
static std::string GetConfigEntry()