4
* Copyright (C) 2009 Tim Marston <edam@waxworlds.org>
6
* This file is part of sqlitepp (hereafter referred to as "this program").
7
* See http://www.waxworlds.org/edam/software/sqlitepp for more information.
9
* This program is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU Lesser General Public License as published
11
* by the Free Software Foundation, either version 3 of the License, or
12
* (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU Lesser General Public License for more details.
19
* You should have received a copy of the GNU Lesser General Public License
20
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23
#ifndef TRANSACTION_HPP_
24
#define TRANSACTION_HPP_
27
#include <boost/utility.hpp>
39
private boost::noncopyable
41
//______________________________________________________________________________
46
* Constructor that provides a database upon which to act
47
* @param database a database
52
virtual ~transaction() throw( );
57
* Constructor that provides a way for deriving classes to override the SQL
58
* executed in beginning and rolling-back a transaction during construction
60
* @param database a database
61
* @param begin_sql the SQL statement used to begin the transaction
62
* @param rollback_sql the SQL statement used to rollback the transaction,
63
* or an empty string if the default is to be used.
67
const std::string &begin_sql,
68
const std::string &rollback_sql = "" );
70
//______________________________________________________________________________
74
* Commit the transaction
76
virtual void commit();
79
* Rollback the transaction
83
//______________________________________________________________________________
90
/** the SQL used to rollback the transaction, or empty to use default */
91
std::string _rollback_sql;
96
////////////////////////////////////////////////////////////////////////////////
99
class exclusive_transaction
103
//______________________________________________________________________________
108
* Constructor that provides a database upon which to act
109
* @param database a database
111
exclusive_transaction(
112
database &database );
120
#endif /* TRANSACTION_HPP_ */