Last change
on this file was
18665,
checked in by westram, 3 years ago
|
- change many WARN_TODO triggered warnings into todo markers.
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
1.8 KB
|
Line | |
---|
1 | // =============================================================== // |
---|
2 | // // |
---|
3 | // File : arbdbpp.cxx // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // Institute of Microbiology (Technical University Munich) // |
---|
7 | // http://www.arb-home.de/ // |
---|
8 | // // |
---|
9 | // =============================================================== // |
---|
10 | |
---|
11 | #include "gb_local.h" |
---|
12 | |
---|
13 | void GB_transaction::init(GBDATA *gb_main, bool initial) { |
---|
14 | ta_main = gb_main; |
---|
15 | ta_open = false; |
---|
16 | ta_err = NULp; |
---|
17 | |
---|
18 | if (ta_main) { |
---|
19 | ta_err = initial ? GB_begin_transaction(ta_main) : GB_push_transaction(ta_main); |
---|
20 | if (!ta_err) { |
---|
21 | ta_open = true; |
---|
22 | } |
---|
23 | } |
---|
24 | else { |
---|
25 | ta_err = "NULp-Transaction"; |
---|
26 | } |
---|
27 | } |
---|
28 | |
---|
29 | ARB_ERROR GB_transaction::close(ARB_ERROR& error) { |
---|
30 | return close(error.deliver()); |
---|
31 | } |
---|
32 | GB_ERROR GB_transaction::close(GB_ERROR error) { |
---|
33 | // abort transaction if error is set |
---|
34 | |
---|
35 | if (error) { |
---|
36 | if (ta_err) { |
---|
37 | ta_err = GBS_global_string("%s\n(previous error: %s)", error, ta_err); |
---|
38 | } |
---|
39 | else { |
---|
40 | ta_err = error; |
---|
41 | } |
---|
42 | } |
---|
43 | |
---|
44 | // @@@ check for exported error here (when GB_export_error gets redesigned) |
---|
45 | |
---|
46 | if (ta_open) { |
---|
47 | ta_err = GB_end_transaction(ta_main, ta_err); |
---|
48 | ta_open = false; |
---|
49 | } |
---|
50 | |
---|
51 | return ta_err; |
---|
52 | } |
---|
53 | |
---|
54 | GB_transaction::~GB_transaction() { |
---|
55 | if (ta_open) { |
---|
56 | GB_ERROR error = close(NULp); |
---|
57 | if (error) { |
---|
58 | fprintf(stderr, "Error while closing transaction: %s\n", error); |
---|
59 | gb_assert(0); // you need to manually use close() |
---|
60 | } |
---|
61 | } |
---|
62 | } |
---|
63 | |
---|
Note: See
TracBrowser
for help on using the repository browser.