TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SQLOperation.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef _SQLOPERATION_H
19 #define _SQLOPERATION_H
20 
21 #include "QueryResult.h"
22 
23 //- Forward declare (don't include header to prevent circular includes)
24 class PreparedStatement;
25 
26 //- Union that holds element data
28 {
30  const char* query;
31 };
32 
33 //- Type specifier of our element data
35 {
38 };
39 
40 //- The element
42 {
45 };
46 
47 //- For ambigious resultsets
49 {
52 };
53 
54 class MySQLConnection;
55 
57 {
58  public:
59  SQLOperation(): m_conn(NULL) { }
60  virtual ~SQLOperation() { }
61 
62  virtual int call()
63  {
64  Execute();
65  return 0;
66  }
67  virtual bool Execute() = 0;
68  virtual void SetConnection(MySQLConnection* con) { m_conn = con; }
69 
70  MySQLConnection* m_conn;
71 
72  private:
73  SQLOperation(SQLOperation const& right) = delete;
74  SQLOperation& operator=(SQLOperation const& right) = delete;
75 };
76 
77 #endif
#define TC_DATABASE_API
Definition: Define.h:122
virtual ~SQLOperation()
Definition: SQLOperation.h:60
Definition: SQLOperation.h:36
ResultSet * qresult
Definition: SQLOperation.h:51
PreparedResultSet * presult
Definition: SQLOperation.h:50
virtual int call()
Definition: SQLOperation.h:62
SQLOperation()
Definition: SQLOperation.h:59
arena_t NULL
Definition: jemalloc_internal.h:624
MySQLConnection * m_conn
Definition: SQLOperation.h:70
PreparedStatement * stmt
Definition: SQLOperation.h:29
Definition: PreparedStatement.h:74
virtual void SetConnection(MySQLConnection *con)
Definition: SQLOperation.h:68
Definition: QueryResult.h:30
Definition: SQLOperation.h:48
const char * query
Definition: SQLOperation.h:30
Definition: SQLOperation.h:27
Vector2int16 & operator=(const Any &a)
SQLElementDataType type
Definition: SQLOperation.h:44
SQLElementDataType
Definition: SQLOperation.h:34
Definition: SQLOperation.h:41
Definition: SQLOperation.h:56
Definition: QueryResult.h:63
SQLElementUnion element
Definition: SQLOperation.h:43
Definition: SQLOperation.h:37