diff options
Diffstat (limited to 'src/shared/Database/Database.h')
-rw-r--r-- | src/shared/Database/Database.h | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/shared/Database/Database.h b/src/shared/Database/Database.h index 6172a61c5f9..34438d994dc 100644 --- a/src/shared/Database/Database.h +++ b/src/shared/Database/Database.h @@ -17,48 +17,35 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef DATABASE_H #define DATABASE_H - #include "Threading.h" #include "Utilities/UnorderedMap.h" #include "Database/SqlDelayThread.h" - class SqlTransaction; class SqlResultQueue; class SqlQueryHolder; - typedef UNORDERED_MAP<ACE_Based::Thread* , SqlTransaction*> TransactionQueues; typedef UNORDERED_MAP<ACE_Based::Thread* , SqlResultQueue*> QueryQueues; - #define MAX_QUERY_LEN 32*1024 - class TRINITY_DLL_SPEC Database { protected: Database() : m_threadBody(NULL), m_delayThread(NULL) {}; - TransactionQueues m_tranQueues; ///< Transaction queues from diff. threads QueryQueues m_queryQueues; ///< Query queues from diff threads SqlDelayThread* m_threadBody; ///< Pointer to delay sql executer (owned by m_delayThread) ACE_Based::Thread* m_delayThread; ///< Pointer to executer thread - public: - virtual ~Database(); - virtual bool Initialize(const char *infoString); virtual void InitDelayThread() = 0; virtual void HaltDelayThread() = 0; - virtual QueryResult* Query(const char *sql) = 0; QueryResult* PQuery(const char *format,...) ATTR_PRINTF(2,3); virtual QueryNamedResult* QueryNamed(const char *sql) = 0; QueryNamedResult* PQueryNamed(const char *format,...) ATTR_PRINTF(2,3); - /// Async queries and query holders, implemented in DatabaseImpl.h - // Query / member template<class Class> bool AsyncQuery(Class *object, void (Class::*method)(QueryResult*), const char *sql); @@ -96,18 +83,14 @@ class TRINITY_DLL_SPEC Database bool DelayQueryHolder(Class *object, void (Class::*method)(QueryResult*, SqlQueryHolder*), SqlQueryHolder *holder); template<class Class, typename ParamType1> bool DelayQueryHolder(Class *object, void (Class::*method)(QueryResult*, SqlQueryHolder*, ParamType1), SqlQueryHolder *holder, ParamType1 param1); - virtual bool Execute(const char *sql) = 0; bool PExecute(const char *format,...) ATTR_PRINTF(2,3); virtual bool DirectExecute(const char* sql) = 0; bool DirectPExecute(const char *format,...) ATTR_PRINTF(2,3); - bool _UpdateDataBlobValue(const uint32 guid, const uint32 field, const int32 value); bool _SetDataBlobValue(const uint32 guid, const uint32 field, const uint32 value); - // Writes SQL commands to a LOG file (see Trinityd.conf "LogSQL") bool PExecuteLog(const char *format,...) ATTR_PRINTF(2,3); - virtual bool BeginTransaction() // nothing do if DB not support transactions { return true; @@ -120,20 +103,15 @@ class TRINITY_DLL_SPEC Database { return false; } - virtual operator bool () const = 0; - virtual unsigned long escape_string(char *to, const char *from, unsigned long length) { strncpy(to,from,length); return length; } void escape_string(std::string& str); - // must be called before first query in thread (one time for thread using one from existed Database objects) virtual void ThreadStart(); // must be called before finish thread run (one time for thread using one from existed Database objects) virtual void ThreadEnd(); - // sets the result queue of the current thread, be careful what thread you call this from void SetResultQueue(SqlResultQueue * queue); - bool CheckRequiredField(char const* table_name, char const* required_name); private: bool m_logSQL; |