Mercurial > hg > orthanc-databases
comparison Framework/MySQL/MySQLTransaction.cpp @ 16:9e419261f1c9
mysql storage area working
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Jul 2018 10:10:35 +0200 |
parents | 7cea966b6829 |
children | 6a574d810b98 |
comparison
equal
deleted
inserted
replaced
15:dfc7002add9c | 16:9e419261f1c9 |
---|---|
33 MySQLTransaction::MySQLTransaction(MySQLDatabase& db) : | 33 MySQLTransaction::MySQLTransaction(MySQLDatabase& db) : |
34 db_(db), | 34 db_(db), |
35 readOnly_(true), | 35 readOnly_(true), |
36 active_(false) | 36 active_(false) |
37 { | 37 { |
38 db_.Execute("START TRANSACTION"); | 38 db_.Execute("START TRANSACTION", false); |
39 active_ = true; | 39 active_ = true; |
40 } | 40 } |
41 | 41 |
42 | 42 |
43 MySQLTransaction::~MySQLTransaction() | 43 MySQLTransaction::~MySQLTransaction() |
46 { | 46 { |
47 LOG(WARNING) << "An active MySQL transaction was dismissed"; | 47 LOG(WARNING) << "An active MySQL transaction was dismissed"; |
48 | 48 |
49 try | 49 try |
50 { | 50 { |
51 db_.Execute("ROLLBACK"); | 51 db_.Execute("ROLLBACK", false); |
52 } | 52 } |
53 catch (Orthanc::OrthancException&) | 53 catch (Orthanc::OrthancException&) |
54 { | 54 { |
55 } | 55 } |
56 } | 56 } |
59 | 59 |
60 void MySQLTransaction::Rollback() | 60 void MySQLTransaction::Rollback() |
61 { | 61 { |
62 if (active_) | 62 if (active_) |
63 { | 63 { |
64 db_.Execute("ROLLBACK"); | 64 db_.Execute("ROLLBACK", false); |
65 active_ = false; | 65 active_ = false; |
66 readOnly_ = true; | 66 readOnly_ = true; |
67 } | 67 } |
68 else | 68 else |
69 { | 69 { |
75 | 75 |
76 void MySQLTransaction::Commit() | 76 void MySQLTransaction::Commit() |
77 { | 77 { |
78 if (active_) | 78 if (active_) |
79 { | 79 { |
80 db_.Execute("COMMIT"); | 80 db_.Execute("COMMIT", false); |
81 active_ = false; | 81 active_ = false; |
82 readOnly_ = true; | 82 readOnly_ = true; |
83 } | 83 } |
84 else | 84 else |
85 { | 85 { |