summaryrefslogtreecommitdiff
path: root/src/core/Database/SQLOperation.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/Database/SQLOperation.h')
-rw-r--r--src/core/Database/SQLOperation.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/core/Database/SQLOperation.h b/src/core/Database/SQLOperation.h
new file mode 100644
index 0000000000..72ce6fd6a0
--- /dev/null
+++ b/src/core/Database/SQLOperation.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C)
+ *
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ */
+
+#ifndef _SQLOPERATION_H
+#define _SQLOPERATION_H
+
+#include <ace/Method_Request.h>
+#include <ace/Activation_Queue.h>
+
+#include "QueryResult.h"
+
+//- Forward declare (don't include header to prevent circular includes)
+class PreparedStatement;
+
+//- Union that holds element data
+union SQLElementUnion
+{
+ PreparedStatement* stmt;
+ const char* query;
+};
+
+//- Type specifier of our element data
+enum SQLElementDataType
+{
+ SQL_ELEMENT_RAW,
+ SQL_ELEMENT_PREPARED
+};
+
+//- The element
+struct SQLElementData
+{
+ SQLElementUnion element;
+ SQLElementDataType type;
+};
+
+//- For ambigious resultsets
+union SQLResultSetUnion
+{
+ PreparedResultSet* presult;
+ ResultSet* qresult;
+};
+
+class MySQLConnection;
+
+class SQLOperation : public ACE_Method_Request
+{
+ public:
+ SQLOperation(): m_conn(NULL) { }
+ virtual int call()
+ {
+ Execute();
+ return 0;
+ }
+ virtual bool Execute() = 0;
+ virtual void SetConnection(MySQLConnection* con) { m_conn = con; }
+
+ MySQLConnection* m_conn;
+};
+
+#endif