sqlitexx: transaction.hpp Source File

sqlitexx 0.0.1

transaction.hpp
Go to the documentation of this file.
1/*
2 * sqlite3xx - sqlite3 C++ layer, following the ideas of libpqxx
3 * Copyright (C) 2009 Andreas Baumann
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions of
7 * the GNU Lesser General Public License, as published by the Free Software
8 * Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 * License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this distribution; if not, write to:
18 * Free Software Foundation, Inc.
19 * 51 Franklin Street, Fifth Floor
20 * Boston, MA 02110-1301 USA
21 *
22 */
23
24#ifndef SQLITE3XX_TRANSACTION_H
25#define SQLITE3XX_TRANSACTION_H
26
27#include "sqlite3xx/connection.hpp"
28#include "sqlite3xx/result.hpp"
29#include "sqlite3xx/prepared_statement.hpp"
30#include "sqlite3.h"
31
32#include "port/dllexport.h"
33
34namespace sqlite3xx {
35
36 class SQLITEXX_LIBEXPORT transaction {
37 private:
38 enum Status {
39 st_nascent,
40 st_active,
41 st_aborted,
42 st_committed
43 };
44
45 private:
46 connection& _c;
47 string _name;
48 Status _status;
49
50 protected:
51 void Begin( );
52
53 public:
54 transaction( connection &c, string name = 0 );
55 ~transaction( );
56
57 void commit( );
58 void abort( );
59
60 result exec( string sql );
61 prepare::invocation prepared( const string& name );
62};
63
64 typedef transaction work;
65
66}
67
68#endif /* SQLITE3XX_TRANSACTION_H */
sqlite3xx::connection
Definition connection.hpp:46
sqlite3xx::prepare::invocation
Definition prepared_statement.hpp:63
sqlite3xx::result
Definition result.hpp:42
sqlite3xx::transaction
Definition transaction.hpp:36
sqlite3xx::transaction::Begin
void Begin()
sqlite3xx::transaction::~transaction
~transaction()
sqlite3xx::transaction::commit
void commit()
sqlite3xx::transaction::prepared
prepare::invocation prepared(const string &name)
sqlite3xx::transaction::transaction
transaction(connection &c, string name=0)
sqlite3xx::transaction::abort
void abort()
sqlite3xx::transaction::exec
result exec(string sql)
connection.hpp
dllexport.h
SQLITEXX_LIBEXPORT
#define SQLITEXX_LIBEXPORT
Definition dllexport.h:35
sqlite3xx
Definition connection.hpp:41
prepared_statement.hpp
result.hpp