ANNA Suite  2020b
Multipurpose development suite for Telco applications
Statement.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_dbms_mysql_Statement_hpp
10 #define anna_dbms_mysql_Statement_hpp
11 
12 #include <anna/dbms/Statement.hpp>
13 
15 
16 namespace anna {
17 
18 namespace dbms {
19 
20 class Connection;
21 
22 namespace mysql {
23 
24 class Database;
25 
36 class Statement : public dbms::Statement {
37 public:
41  virtual ~Statement();
42 
47  operator st_mysql_stmt*() { return a_mysqlStmt; }
48 
54  st_mysql_bind* getBindParams() { return a_params; }
55 
61  st_mysql_bind* getBindResults() { return a_results; }
62 
63 private:
64  st_mysql_stmt* a_mysqlStmt;
65 
66  st_mysql_bind* a_params;
67  st_mysql_bind* a_results;
68 
69  Statement(Database& database, const char* name, const char* expression, const bool isCritical) :
70  dbms::Statement(database, name, expression, isCritical),
71  a_mysqlStmt(NULL),
72  a_params(NULL),
73  a_results(NULL) {}
74 
75  Statement(Database& database, const char* name, const std::string& expression, const bool isCritical) :
76  dbms::Statement(database, name, expression, isCritical),
77  a_mysqlStmt(NULL),
78  a_params(NULL),
79  a_results(NULL) {}
80 
81  st_mysql_bind* create(const int size, const char* whatis) noexcept(false);
82 
83  void prepare(dbms::Connection* connection) noexcept(false);
84  dbms::ResultCode execute(dbms::Connection* connection) noexcept(false);
85  bool fetch() noexcept(false);
86 
87  friend class Database;
88 };
89 
90 }
91 }
92 }
93 
94 #endif
95 
Definition: Connection.hpp:38
Definition: Statement.hpp:36
st_mysql_bind * getBindResults()
Definition: Statement.hpp:61
Definition: Statement.hpp:43
bool isCritical() const
Definition: Statement.hpp:72
st_mysql_bind * getBindParams()
Definition: Statement.hpp:54
Definition: app.hpp:12
Definition: Database.hpp:24
Definition: ResultCode.hpp:29