mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-02 23:40:26 +00:00
Warning fixes, general cleanup (#5053)
This commit is contained in:
+20
-18
@@ -17,11 +17,11 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "common/mutex.h"
|
||||
#include "common/mysql_request_result.h"
|
||||
#include "common/types.h"
|
||||
|
||||
#include "mysql.h"
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#define CR_SERVER_GONE_ERROR 2006
|
||||
@@ -29,12 +29,15 @@
|
||||
|
||||
namespace mysql { class PreparedStmt; }
|
||||
|
||||
class DBcore {
|
||||
class DBcore
|
||||
{
|
||||
public:
|
||||
enum eStatus {
|
||||
Closed, Connected, Error
|
||||
};
|
||||
|
||||
using Mutex = std::recursive_mutex;
|
||||
|
||||
DBcore();
|
||||
~DBcore();
|
||||
eStatus GetStatus() { return pStatus; }
|
||||
@@ -48,17 +51,17 @@ public:
|
||||
uint32 DoEscapeString(char *tobuf, const char *frombuf, uint32 fromlen);
|
||||
void ping();
|
||||
|
||||
const std::string &GetOriginHost() const;
|
||||
void SetOriginHost(const std::string &origin_host);
|
||||
const std::string& GetOriginHost() const;
|
||||
void SetOriginHost(const std::string& origin_host);
|
||||
|
||||
bool DoesTableExist(const std::string& table_name);
|
||||
|
||||
void SetMySQL(const DBcore &o)
|
||||
void SetMySQL(const DBcore& o)
|
||||
{
|
||||
mysql = o.mysql;
|
||||
mysqlOwner = false;
|
||||
}
|
||||
void SetMutex(Mutex *mutex);
|
||||
void SetMutex(const std::shared_ptr<Mutex>& mutex);
|
||||
|
||||
// only safe on connections shared with other threads if results buffered
|
||||
// unsafe to use off main thread due to internal server logging
|
||||
@@ -81,22 +84,21 @@ protected:
|
||||
private:
|
||||
bool Open(uint32 *errnum = nullptr, char *errbuf = nullptr);
|
||||
|
||||
MYSQL* mysql;
|
||||
bool mysqlOwner;
|
||||
Mutex *m_mutex;
|
||||
eStatus pStatus;
|
||||
MYSQL* mysql = nullptr;
|
||||
bool mysqlOwner = true;
|
||||
eStatus pStatus = Closed;
|
||||
|
||||
std::mutex m_query_lock{};
|
||||
std::shared_ptr<Mutex> m_mutex;
|
||||
|
||||
std::string origin_host;
|
||||
|
||||
char *pHost;
|
||||
char *pUser;
|
||||
char *pPassword;
|
||||
char *pDatabase;
|
||||
bool pCompress;
|
||||
uint32 pPort;
|
||||
bool pSSL;
|
||||
std::string m_host;
|
||||
std::string m_user;
|
||||
std::string m_password;
|
||||
std::string m_database;
|
||||
bool pCompress = false;
|
||||
uint32 pPort = 0;
|
||||
bool pSSL = false;
|
||||
|
||||
// allows multiple queries to be executed within the same query
|
||||
// do not use this under normal operation
|
||||
|
||||
Reference in New Issue
Block a user