AnCH Framework  0.1
Another C++ Hack Framework
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
sqlite3Connection.hpp
1 /*
2  ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3  Copyright (C) 2012 Vincent Lachenal
4 
5  This file is part of ANCH Framework.
6 
7  ANCH Framework is free software: you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  ANCH Framework is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19 */
20 #ifdef ANCH_SQL_SQLITE3
21 #ifndef _ANCH_SQL_SQLITE3CON_H_
22 #define _ANCH_SQL_SQLITE3CON_H_
23 
24 #include "sql/connection.hpp"
25 
26 #include "sqlite3.h"
27 
28 
29 namespace anch {
30  namespace sql {
31 
41  class SQLite3Connection: public Connection {
42 
43  // Attributes +
44  private:
46  sqlite3* _conn;
47  // Attributes -
48 
49  // Constructors +
50  public:
58  SQLite3Connection(const std::string& database)
59  throw(SqlException);
60 
69  throw(SqlException);
70 
74  SQLite3Connection(const SQLite3Connection&) = delete;
75  // Constructors -
76 
77  // Destructor +
82  // Destructor -
83 
84  // Methods +
85  protected:
95  virtual ResultSet* executeQuery(const std::string& query) throw(SqlException) override;
96 
106  virtual uint64_t executeUpdate(const std::string& query) throw(SqlException) override;
107 
113  virtual void sendCommit() throw(SqlException) override;
114 
120  virtual void sendRollback() throw(SqlException) override;
121 
129  virtual void toggleAutoCommit(bool autoCommit) throw(SqlException) override;
130  // Methods -
131 
132  };
133 
134  }
135 }
136 
137 #endif // _ANCH_SQL_SQLITE3CON_H_
138 #endif // ANCH_SQL_SQLITE3
SQLite3 connection.
Definition: sqlite3Connection.hpp:41
SQL database connection configuration.
Definition: connection.hpp:41
SQLite3Connection(const std::string &database)
Definition: sqlite3Connection.cpp:35
SQL exception.
Definition: sqlException.hpp:39
virtual void sendRollback() override
Definition: sqlite3Connection.cpp:113
virtual void toggleAutoCommit(bool autoCommit) override
Definition: sqlite3Connection.cpp:125
SQL result representation.
Definition: resultSet.hpp:44
AnCH framework base namespace.
Definition: base64.hpp:28
SQL connection virtual class.
Definition: connection.hpp:73
ResultSet * query(const std::string &query)
Definition: connection.cpp:61
virtual void sendCommit() override
Definition: sqlite3Connection.cpp:101
~SQLite3Connection()
Definition: sqlite3Connection.cpp:63
virtual ResultSet * executeQuery(const std::string &query) override
Definition: sqlite3Connection.cpp:70
virtual uint64_t executeUpdate(const std::string &query) override
Definition: sqlite3Connection.cpp:88