mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
[QS] Database class name change (#2743)
This commit is contained in:
parent
7aa25f17f6
commit
9e3539295b
@ -50,56 +50,8 @@
|
|||||||
#include "../common/strings.h"
|
#include "../common/strings.h"
|
||||||
#include "../common/servertalk.h"
|
#include "../common/servertalk.h"
|
||||||
|
|
||||||
Database::Database()
|
|
||||||
{
|
|
||||||
DBInitVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
void QSDatabase::AddSpeech(
|
||||||
Establish a connection to a mysql database with the supplied parameters
|
|
||||||
*/
|
|
||||||
|
|
||||||
Database::Database(const char *host, const char *user, const char *passwd, const char *database, uint32 port)
|
|
||||||
{
|
|
||||||
DBInitVars();
|
|
||||||
Connect(host, user, passwd, database, port);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Database::Connect(const char *host, const char *user, const char *passwd, const char *database, uint32 port)
|
|
||||||
{
|
|
||||||
uint32 errnum = 0;
|
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
|
||||||
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
|
|
||||||
LogError("Failed to connect to database: Error: {}", errbuf);
|
|
||||||
HandleMysqlError(errnum);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LogInfo("Using database [{}] at [{}]:[{}]", database, host, port);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Database::DBInitVars()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Database::HandleMysqlError(uint32 errnum)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Close the connection to the database
|
|
||||||
*/
|
|
||||||
Database::~Database()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Database::AddSpeech(
|
|
||||||
const char *from,
|
const char *from,
|
||||||
const char *to,
|
const char *to,
|
||||||
const char *message,
|
const char *message,
|
||||||
@ -134,7 +86,7 @@ void Database::AddSpeech(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::LogPlayerDropItem(QSPlayerDropItem_Struct *QS)
|
void QSDatabase::LogPlayerDropItem(QSPlayerDropItem_Struct *QS)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string query = StringFormat(
|
std::string query = StringFormat(
|
||||||
@ -173,7 +125,7 @@ void Database::LogPlayerDropItem(QSPlayerDropItem_Struct *QS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::LogPlayerTrade(QSPlayerLogTrade_Struct *QS, uint32 detailCount)
|
void QSDatabase::LogPlayerTrade(QSPlayerLogTrade_Struct *QS, uint32 detailCount)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string query = StringFormat(
|
std::string query = StringFormat(
|
||||||
@ -220,7 +172,7 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct *QS, uint32 detailCount)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::LogPlayerHandin(QSPlayerLogHandin_Struct *QS, uint32 detailCount)
|
void QSDatabase::LogPlayerHandin(QSPlayerLogHandin_Struct *QS, uint32 detailCount)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string query = StringFormat(
|
std::string query = StringFormat(
|
||||||
@ -269,7 +221,7 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct *QS, uint32 detailCount)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct *QS, uint32 members)
|
void QSDatabase::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct *QS, uint32 members)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string query = StringFormat(
|
std::string query = StringFormat(
|
||||||
@ -306,7 +258,7 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct *QS, uint32 members)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::LogPlayerDelete(QSPlayerLogDelete_Struct *QS, uint32 items)
|
void QSDatabase::LogPlayerDelete(QSPlayerLogDelete_Struct *QS, uint32 items)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string query = StringFormat(
|
std::string query = StringFormat(
|
||||||
@ -345,7 +297,7 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct *QS, uint32 items)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::LogPlayerMove(QSPlayerLogMove_Struct *QS, uint32 items)
|
void QSDatabase::LogPlayerMove(QSPlayerLogMove_Struct *QS, uint32 items)
|
||||||
{
|
{
|
||||||
/* These are item moves */
|
/* These are item moves */
|
||||||
|
|
||||||
@ -385,7 +337,7 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct *QS, uint32 items)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct *QS, uint32 items)
|
void QSDatabase::LogMerchantTransaction(QSMerchantLogTransaction_Struct *QS, uint32 items)
|
||||||
{
|
{
|
||||||
/* Merchant transactions are from the perspective of the merchant, not the player */
|
/* Merchant transactions are from the perspective of the merchant, not the player */
|
||||||
std::string query = StringFormat(
|
std::string query = StringFormat(
|
||||||
@ -433,7 +385,7 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct *QS, uint3
|
|||||||
}
|
}
|
||||||
|
|
||||||
// this function does not delete the ServerPacket, so it must be handled at call site
|
// this function does not delete the ServerPacket, so it must be handled at call site
|
||||||
void Database::GeneralQueryReceive(ServerPacket *pack)
|
void QSDatabase::GeneralQueryReceive(ServerPacket *pack)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
These are general queries passed from anywhere in zone instead of packing structures and breaking them down again and again
|
These are general queries passed from anywhere in zone instead of packing structures and breaking them down again and again
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
#include "../common/eqemu_logsys.h"
|
#include "../common/eqemu_logsys.h"
|
||||||
#include "../common/global_define.h"
|
#include "../common/global_define.h"
|
||||||
#include "../common/types.h"
|
#include "../common/types.h"
|
||||||
#include "../common/dbcore.h"
|
#include "../common/database.h"
|
||||||
#include "../common/linked_list.h"
|
#include "../common/linked_list.h"
|
||||||
#include "../common/servertalk.h"
|
#include "../common/servertalk.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -36,13 +36,8 @@
|
|||||||
//atoi is not uint32 or uint32 safe!!!!
|
//atoi is not uint32 or uint32 safe!!!!
|
||||||
#define atoul(str) strtoul(str, nullptr, 10)
|
#define atoul(str) strtoul(str, nullptr, 10)
|
||||||
|
|
||||||
class Database : public DBcore {
|
class QSDatabase : public Database {
|
||||||
public:
|
public:
|
||||||
Database();
|
|
||||||
Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
|
||||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
|
||||||
~Database();
|
|
||||||
|
|
||||||
void AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type);
|
void AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type);
|
||||||
void LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 DetailCount);
|
void LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 DetailCount);
|
||||||
void LogPlayerDropItem(QSPlayerDropItem_Struct* QS);
|
void LogPlayerDropItem(QSPlayerDropItem_Struct* QS);
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#include "../common/rulesys.h"
|
#include "../common/rulesys.h"
|
||||||
|
|
||||||
extern WorldServer *worldserver;
|
extern WorldServer *worldserver;
|
||||||
extern Database database;
|
extern QSDatabase database;
|
||||||
|
|
||||||
PlayerLookingForGuild::PlayerLookingForGuild(char *Name, char *Comments, uint32 Level, uint32 Class, uint32 AACount, uint32 Timezone, uint32 TimePosted)
|
PlayerLookingForGuild::PlayerLookingForGuild(char *Name, char *Comments, uint32 Level, uint32 Class, uint32 AACount, uint32 Timezone, uint32 TimePosted)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -32,19 +32,21 @@
|
|||||||
#include "lfguild.h"
|
#include "lfguild.h"
|
||||||
#include "worldserver.h"
|
#include "worldserver.h"
|
||||||
#include "../common/path_manager.h"
|
#include "../common/path_manager.h"
|
||||||
|
#include "../common/zone_store.h"
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
volatile bool RunLoops = true;
|
volatile bool RunLoops = true;
|
||||||
|
|
||||||
Database database;
|
QSDatabase database;
|
||||||
LFGuildManager lfguildmanager;
|
LFGuildManager lfguildmanager;
|
||||||
std::string WorldShortName;
|
std::string WorldShortName;
|
||||||
const queryservconfig *Config;
|
const queryservconfig *Config;
|
||||||
WorldServer *worldserver = 0;
|
WorldServer *worldserver = 0;
|
||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
PathManager path;
|
PathManager path;
|
||||||
|
ZoneStore zone_store;
|
||||||
|
|
||||||
void CatchSignal(int sig_num)
|
void CatchSignal(int sig_num)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
|
|
||||||
extern WorldServer worldserver;
|
extern WorldServer worldserver;
|
||||||
extern const queryservconfig *Config;
|
extern const queryservconfig *Config;
|
||||||
extern Database database;
|
extern QSDatabase database;
|
||||||
extern LFGuildManager lfguildmanager;
|
extern LFGuildManager lfguildmanager;
|
||||||
|
|
||||||
WorldServer::WorldServer()
|
WorldServer::WorldServer()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user