Main Page
Namespaces
Classes
Files
File List
File Members
libism
ISM
soci
src
core
transaction.cpp
Go to the documentation of this file.
1
//
2
// Copyright (C) 2004-2008 Maciej Sobczak
3
// Distributed under the Boost Software License, Version 1.0.
4
// (See accompanying file LICENSE_1_0.txt or copy at
5
// http://www.boost.org/LICENSE_1_0.txt)
6
//
7
8
#define SOCI_SOURCE
9
#include "
transaction.h
"
10
#include "
error.h
"
11
12
using namespace
soci
;
13
14
transaction::transaction
(
session
& sql)
15
: handled_(false), sql_(sql)
16
{
17
sql_
.
begin
();
18
}
19
20
transaction::~transaction
()
21
{
22
if
(
handled_
==
false
)
23
{
24
try
25
{
26
rollback
();
27
}
28
catch
(...)
29
{}
30
}
31
}
32
33
void
transaction::commit
()
34
{
35
if
(
handled_
)
36
{
37
throw
soci_error
(
"The transaction object cannot be handled twice."
);
38
}
39
40
sql_
.
commit
();
41
handled_
=
true
;
42
}
43
44
void
transaction::rollback
()
45
{
46
if
(
handled_
)
47
{
48
throw
soci_error
(
"The transaction object cannot be handled twice."
);
49
}
50
51
sql_
.
rollback
();
52
handled_
=
true
;
53
}
soci::transaction::rollback
void rollback()
Definition:
transaction.cpp:44
error.h
soci::transaction::~transaction
~transaction()
Definition:
transaction.cpp:20
soci::session::commit
void commit()
Definition:
core/session.cpp:190
soci::session::rollback
void rollback()
Definition:
core/session.cpp:197
soci::transaction::sql_
session & sql_
Definition:
transaction.h:29
soci::transaction::commit
void commit()
Definition:
transaction.cpp:33
soci::transaction::handled_
bool handled_
Definition:
transaction.h:28
soci::soci_error
Definition:
core/error.h:19
soci::session
Definition:
session.h:40
soci::session::begin
void begin()
Definition:
core/session.cpp:183
soci::transaction::transaction
transaction(session &sql)
Definition:
transaction.cpp:14
soci
Definition:
db2/common.h:15
transaction.h
asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:41