Core/DBLayer:

- Add basic prepared statement interface (without implementation and thus without testing, without resultset support).
- Based on raczman/Albator´s work on TrinityCore3

Build:
- Add sLog define ¨hack¨ in DatbaseWorkerPool.h to fix some more sLog errors temporarily

FYI: Builds on windows

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-09-02 20:54:43 +02:00
parent cd182a1e8f
commit 1198591bac
5 changed files with 570 additions and 0 deletions

View File

@@ -20,6 +20,8 @@
#define _MYSQLCONNECTION_H
class DatabaseWorker;
class PreparedStatement;
class MySQLPreparedStatement;
class MySQLConnection
{
@@ -34,6 +36,7 @@ class MySQLConnection
public:
bool Execute(const char* sql);
bool Execute(PreparedStatement* stmt);
QueryResult_AutoPtr Query(const char* sql);
bool _Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD **pFields, uint64* pRowCount, uint32* pFieldCount);
@@ -45,12 +48,15 @@ class MySQLConnection
protected:
MYSQL* GetHandle() { return m_Mysql; }
MySQLPreparedStatement* GetPreparedStatement(uint32 index);
void PrepareStatement(uint32 index, const char* sql);
private:
ACE_Activation_Queue* m_queue; //! Queue shared with other asynchroneous connections.
DatabaseWorker* m_worker; //! Core worker task.
MYSQL * m_Mysql; //! MySQL Handle.
ACE_Thread_Mutex m_Mutex;
std::vector<MySQLPreparedStatement*> m_stmts; //! PreparedStatements storage
};
#endif