aboutsummaryrefslogtreecommitdiff
path: root/mp/src/utils/common/MySqlDatabase.h
diff options
context:
space:
mode:
authorJørgen P. Tjernø <[email protected]>2013-12-02 19:31:46 -0800
committerJørgen P. Tjernø <[email protected]>2013-12-02 19:46:31 -0800
commitf56bb35301836e56582a575a75864392a0177875 (patch)
treede61ddd39de3e7df52759711950b4c288592f0dc /mp/src/utils/common/MySqlDatabase.h
parentMark some more files as text. (diff)
downloadsource-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz
source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/utils/common/MySqlDatabase.h')
-rw-r--r--mp/src/utils/common/MySqlDatabase.h208
1 files changed, 104 insertions, 104 deletions
diff --git a/mp/src/utils/common/MySqlDatabase.h b/mp/src/utils/common/MySqlDatabase.h
index caa5855c..52517f6d 100644
--- a/mp/src/utils/common/MySqlDatabase.h
+++ b/mp/src/utils/common/MySqlDatabase.h
@@ -1,104 +1,104 @@
-//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//=============================================================================//
-
-#ifndef MYSQLDATABASE_H
-#define MYSQLDATABASE_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-#include <windows.h>
-#include "ISQLDBReplyTarget.h"
-#include "utlvector.h"
-#include "UtlLinkedList.h"
-
-class ISQLDBCommand;
-
-//-----------------------------------------------------------------------------
-// Purpose: Generic MySQL accessing database
-// Provides threaded I/O queue functionality for accessing a mysql db
-//-----------------------------------------------------------------------------
-class CMySqlDatabase
-{
-public:
- // constructor
- CMySqlDatabase();
- ~CMySqlDatabase();
-
- // initialization - must be called before this object can be used
- bool Initialize();
-
- // Dispatches responses to SQLDB queries
- bool RunFrame();
-
- // load info - returns the number of sql db queries waiting to be processed
- virtual int QueriesInOutQueue();
-
- // number of queries finished processing, waiting to be responded to
- virtual int QueriesInFinishedQueue();
-
- // activates the thread
- void RunThread();
-
- // command queues
- void AddCommandToQueue(ISQLDBCommand *cmd, ISQLDBReplyTarget *replyTarget, int returnState = 0);
-
-private:
-
- // threading data
- bool m_bRunThread;
- CRITICAL_SECTION m_csThread;
- CRITICAL_SECTION m_csInQueue;
- CRITICAL_SECTION m_csOutQueue;
- CRITICAL_SECTION m_csDBAccess;
-
- // wait event
- HANDLE m_hEvent;
-
- struct msg_t
- {
- ISQLDBCommand *cmd;
- ISQLDBReplyTarget *replyTarget;
- int result;
- int returnState;
- };
-
- // command queues
- CUtlLinkedList<msg_t, int> m_InQueue;
- CUtlLinkedList<msg_t, int> m_OutQueue;
-};
-
-class Connection;
-
-//-----------------------------------------------------------------------------
-// Purpose: Interface to a command
-//-----------------------------------------------------------------------------
-class ISQLDBCommand
-{
-public:
- // makes the command run (blocking), returning the success code
- virtual int RunCommand() = 0;
-
- // return data
- virtual void *GetReturnData() { return NULL; }
-
- // returns the command ID
- virtual int GetID() { return 0; }
-
- // gets information about the command for if it failed
- virtual void GetDebugInfo(char *buf, int bufSize) { buf[0] = 0; }
-
- // use to delete
- virtual void deleteThis() = 0;
-
-protected:
- // protected destructor, so that it has to be deleted through deleteThis()
- virtual ~ISQLDBCommand() {}
-};
-
-
-#endif // MYSQLDATABASE_H
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef MYSQLDATABASE_H
+#define MYSQLDATABASE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include <windows.h>
+#include "ISQLDBReplyTarget.h"
+#include "utlvector.h"
+#include "UtlLinkedList.h"
+
+class ISQLDBCommand;
+
+//-----------------------------------------------------------------------------
+// Purpose: Generic MySQL accessing database
+// Provides threaded I/O queue functionality for accessing a mysql db
+//-----------------------------------------------------------------------------
+class CMySqlDatabase
+{
+public:
+ // constructor
+ CMySqlDatabase();
+ ~CMySqlDatabase();
+
+ // initialization - must be called before this object can be used
+ bool Initialize();
+
+ // Dispatches responses to SQLDB queries
+ bool RunFrame();
+
+ // load info - returns the number of sql db queries waiting to be processed
+ virtual int QueriesInOutQueue();
+
+ // number of queries finished processing, waiting to be responded to
+ virtual int QueriesInFinishedQueue();
+
+ // activates the thread
+ void RunThread();
+
+ // command queues
+ void AddCommandToQueue(ISQLDBCommand *cmd, ISQLDBReplyTarget *replyTarget, int returnState = 0);
+
+private:
+
+ // threading data
+ bool m_bRunThread;
+ CRITICAL_SECTION m_csThread;
+ CRITICAL_SECTION m_csInQueue;
+ CRITICAL_SECTION m_csOutQueue;
+ CRITICAL_SECTION m_csDBAccess;
+
+ // wait event
+ HANDLE m_hEvent;
+
+ struct msg_t
+ {
+ ISQLDBCommand *cmd;
+ ISQLDBReplyTarget *replyTarget;
+ int result;
+ int returnState;
+ };
+
+ // command queues
+ CUtlLinkedList<msg_t, int> m_InQueue;
+ CUtlLinkedList<msg_t, int> m_OutQueue;
+};
+
+class Connection;
+
+//-----------------------------------------------------------------------------
+// Purpose: Interface to a command
+//-----------------------------------------------------------------------------
+class ISQLDBCommand
+{
+public:
+ // makes the command run (blocking), returning the success code
+ virtual int RunCommand() = 0;
+
+ // return data
+ virtual void *GetReturnData() { return NULL; }
+
+ // returns the command ID
+ virtual int GetID() { return 0; }
+
+ // gets information about the command for if it failed
+ virtual void GetDebugInfo(char *buf, int bufSize) { buf[0] = 0; }
+
+ // use to delete
+ virtual void deleteThis() = 0;
+
+protected:
+ // protected destructor, so that it has to be deleted through deleteThis()
+ virtual ~ISQLDBCommand() {}
+};
+
+
+#endif // MYSQLDATABASE_H