TrinityCore
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 <string>
24
25template <class T>
27
28namespace boost
29{
30 namespace filesystem
31 {
32 class path;
33 }
34}
35
36class TC_DATABASE_API UpdateException : public std::exception
37{
38public:
39 UpdateException(std::string const& msg) : _msg(msg) { }
40 ~UpdateException() throw() { }
41
42 char const* what() const throw() override { return _msg.c_str(); }
43
44private:
45 std::string const _msg;
46};
47
49{
52};
53
55{
56public:
57 static std::string GetCorrectedMySQLExecutable();
58
59 static bool CheckExecutable();
60
61private:
62 static std::string& corrected_path();
63};
64
65template <class T>
67{
68public:
69 using Path = boost::filesystem::path;
70
71 static inline std::string GetConfigEntry();
72
73 static inline std::string GetTableName();
74
75 static std::string GetBaseFile();
76
77 static bool IsEnabled(uint32 const updateMask);
78
79 static BaseLocation GetBaseLocationType();
80
81 static bool Create(DatabaseWorkerPool<T>& pool);
82
83 static bool Update(DatabaseWorkerPool<T>& pool);
84
85 static bool Populate(DatabaseWorkerPool<T>& pool);
86
87private:
88 static QueryResult Retrieve(DatabaseWorkerPool<T>& pool, std::string const& query);
89 static void Apply(DatabaseWorkerPool<T>& pool, std::string const& query);
90 static void ApplyFile(DatabaseWorkerPool<T>& pool, Path const& path);
91 static void ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& host, std::string const& user,
92 std::string const& password, std::string const& port_or_socket, std::string const& database, std::string const& ssl,
93 Path const& path);
94};
95
96#endif // DBUpdater_h__
BaseLocation
Definition: DBUpdater.h:49
@ LOCATION_DOWNLOAD
Definition: DBUpdater.h:51
@ LOCATION_REPOSITORY
Definition: DBUpdater.h:50
std::shared_ptr< ResultSet > QueryResult
#define TC_DATABASE_API
Definition: Define.h:111
uint32_t uint32
Definition: Define.h:142
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:69
static std::string GetBaseFile()
static std::string GetTableName()
static bool IsEnabled(uint32 const updateMask)
static std::string GetConfigEntry()
std::string const _msg
Definition: DBUpdater.h:45
char const * what() const override
Definition: DBUpdater.h:42
UpdateException(std::string const &msg)
Definition: DBUpdater.h:39
std::unique_ptr< VignetteData > Create(VignetteEntry const *vignetteData, WorldObject const *owner)
Definition: Vignette.cpp:72
void Update(VignetteData &vignette, WorldObject const *owner)
Definition: Vignette.cpp:90