Skip to content

Commit

Permalink
Revert "feat(Common/Database): correct impl Extra DB" (azerothcore#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoBorzi authored Jun 29, 2021
1 parent 61770ea commit fd814d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 26 deletions.
19 changes: 7 additions & 12 deletions modules/mod-as-common/src/game/ExtraDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
#include "MySQLPreparedStatement.h"
#include "DatabaseLoader.h"

class DatabaseLoader;

template class AC_DATABASE_API DatabaseWorkerPool<ExtraDatabaseConnection>;
DatabaseWorkerPool<ExtraDatabaseConnection> ExtraDatabase;

void ExtraDatabaseConnection::DoPrepareStatements()
{
if (!m_reconnecting)
Expand All @@ -31,15 +36,5 @@ void ExtraDatabaseConnection::DoPrepareStatements()
PrepareStatement(EXTRA_DEL_EXTERNAL_MAIL, "DELETE FROM mail_external WHERE id = ?", CONNECTION_ASYNC);
}

ExtraDatabaseConnection::ExtraDatabaseConnection(MySQLConnectionInfo& connInfo) :
MySQLConnection(connInfo) { }

ExtraDatabaseConnection::ExtraDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) :
MySQLConnection(q, connInfo) { }

ExtraDatabaseConnection::~ExtraDatabaseConnection() { }

DatabaseWorkerPool<ExtraDatabaseConnection> ExtraDatabase;

template AC_DATABASE_API
DatabaseLoader& DatabaseLoader::AddDatabase<ExtraDatabaseConnection>(DatabaseWorkerPool<ExtraDatabaseConnection>&, std::string const&);
// template AC_DATABASE_API
// DatabaseLoader& DatabaseLoader::AddDatabase<ExtraDatabaseConnection>(DatabaseWorkerPool<ExtraDatabaseConnection>&, std::string const&);
22 changes: 8 additions & 14 deletions modules/mod-as-common/src/game/ExtraDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "MySQLConnection.h"
#include "DatabaseEnv.h"

enum ExtraDatabaseStatements : uint32
enum ExtraDatabaseStatements
{
/* Naming standard for defines:
{DB}_{SET/DEL/ADD/REP}_{Summary of data changed}
Expand All @@ -36,24 +36,18 @@ enum ExtraDatabaseStatements : uint32

class AC_DATABASE_API ExtraDatabaseConnection : public MySQLConnection
{
public:
typedef ExtraDatabaseStatements Statements;
public:
typedef ExtraDatabaseStatements Statements;

//- Constructors for sync and async connections
ExtraDatabaseConnection(MySQLConnectionInfo& connInfo);
ExtraDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo);
~ExtraDatabaseConnection();
//- Constructors for sync and async connections
ExtraDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) {}
ExtraDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) {}


//- Loads databasetype specific prepared statements
void DoPrepareStatements() override;
//- Loads databasetype specific prepared statements
void DoPrepareStatements();
};

/// Accessor to the extra database
AC_DATABASE_API extern DatabaseWorkerPool<ExtraDatabaseConnection> ExtraDatabase;

using ExtraDatabasePreparedStatement = PreparedStatement<ExtraDatabaseConnection>;
using ExtraDatabaseTransaction = SQLTransaction<ExtraDatabaseConnection>;
using ExtraDatabaseQueryHolder = SQLQueryHolder<ExtraDatabaseConnection>;

#endif

0 comments on commit fd814d5

Please sign in to comment.