4
// Author : Sylvain Rochette Langlois
5
// License : Boost Software License (http://www.boost.org/users/license.html)
8
#ifndef _MARIADB_CONNECTION_HPP_
9
#define _MARIADB_CONNECTION_HPP_
12
#include "account.hpp"
13
#include "statement.hpp"
14
#include "transaction.hpp"
15
#include "save_point.hpp"
16
#include "result_set.hpp"
19
// C++ wrapper over mariadb-native-client API
24
class connection : public last_error
26
friend class result_set;
27
friend class statement;
28
friend class transaction;
29
friend class save_point;
35
virtual ~connection();
38
// Connect to the database
43
// Disconnect from the database
48
// Tell if a connection is currently active to the database
50
bool connected() const;
55
account_ref account() const;
58
// Get / Set schema (database)
60
const char* schema() const;
61
bool set_schema(const char* schema);
64
// Execute a query with or without statement
66
s32 execute(const char* query);
67
u32 insert(const char* query);
68
result_set_ref query(const char* query);
71
// Set auto commit mode
73
bool auto_commit() const;
74
bool set_auto_commit(bool auto_commit);
80
statement_ref create_statement(const char* query);
83
// Commit / rollback support
85
transaction_ref create_transaction(isolation::level level = isolation::repeatable_read, bool consistent_snapshot = true);
89
// Create a new connection
91
static connection_ref create(account_ref& account);
97
connection(account_ref& account);
102
std::string m_schema;
103
account_ref m_account;
4
// Author : Sylvain Rochette Langlois
5
// License : Boost Software License (http://www.boost.org/users/license.html)
8
#ifndef _MARIADB_CONNECTION_HPP_
9
#define _MARIADB_CONNECTION_HPP_
12
#include <mariadb++/account.hpp>
13
#include <mariadb++/statement.hpp>
14
#include <mariadb++/transaction.hpp>
15
#include <mariadb++/save_point.hpp>
16
#include <mariadb++/result_set.hpp>
19
typedef struct st_mysql MYSQL;
22
// C++ wrapper over mariadb-native-client API
27
class connection : public last_error
29
friend class result_set;
30
friend class statement;
31
friend class transaction;
32
friend class save_point;
38
virtual ~connection();
41
// Connect to the database
46
// Disconnect from the database
51
// Tell if a connection is currently active to the database
53
bool connected() const;
58
account_ref account() const;
61
// Get / Set schema (database)
63
const char* schema() const;
64
bool set_schema(const char* schema);
67
// Get / Set character set
69
const std::string& charset() const;
70
bool set_charset(const std::string& value);
73
// Execute a query with or without statement
75
u64 execute(const std::string& query);
76
u64 insert(const std::string& query);
77
result_set_ref query(const std::string& query);
80
// Set auto commit mode
82
bool auto_commit() const;
83
bool set_auto_commit(bool auto_commit);
89
statement_ref create_statement(const char* query);
92
// Commit / rollback support
94
transaction_ref create_transaction(isolation::level level = isolation::repeatable_read, bool consistent_snapshot = true);
98
// Create a new connection
100
static connection_ref create(account_ref& account);
106
connection(account_ref& account);
111
std::string m_schema;
112
std::string m_charset;
113
account_ref m_account;