comparison Core/SQLite/Transaction.cpp @ 59:c996319e90bc orthanc-renaming

renaming in Core
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 16 Sep 2012 09:28:56 +0200
parents a15e90e5d6fc
children bdd72233b105
comparison
equal deleted inserted replaced
58:6da7fc87efaa 59:c996319e90bc
1 /** 1 /**
2 * Palanthir - A Lightweight, RESTful DICOM Store 2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege, 3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
4 * Belgium 4 * Belgium
5 * 5 *
6 * Copyright (c) 2012 The Chromium Authors. All rights reserved. 6 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
7 * 7 *
34 **/ 34 **/
35 35
36 36
37 #include "Transaction.h" 37 #include "Transaction.h"
38 38
39 namespace Palanthir 39 namespace Orthanc
40 { 40 {
41 namespace SQLite 41 namespace SQLite
42 { 42 {
43 Transaction::Transaction(Connection& connection) : 43 Transaction::Transaction(Connection& connection) :
44 connection_(connection), 44 connection_(connection),
56 56
57 void Transaction::Begin() 57 void Transaction::Begin()
58 { 58 {
59 if (isOpen_) 59 if (isOpen_)
60 { 60 {
61 throw PalanthirException("SQLite: Beginning a transaction twice!"); 61 throw OrthancException("SQLite: Beginning a transaction twice!");
62 } 62 }
63 63
64 isOpen_ = connection_.BeginTransaction(); 64 isOpen_ = connection_.BeginTransaction();
65 if (!isOpen_) 65 if (!isOpen_)
66 { 66 {
67 throw PalanthirException("SQLite: Unable to create a transaction"); 67 throw OrthancException("SQLite: Unable to create a transaction");
68 } 68 }
69 } 69 }
70 70
71 void Transaction::Rollback() 71 void Transaction::Rollback()
72 { 72 {
73 if (!isOpen_) 73 if (!isOpen_)
74 { 74 {
75 throw PalanthirException("SQLite: Attempting to roll back a nonexistent transaction. " 75 throw OrthancException("SQLite: Attempting to roll back a nonexistent transaction. "
76 "Did you remember to call Begin()?"); 76 "Did you remember to call Begin()?");
77 } 77 }
78 78
79 isOpen_ = false; 79 isOpen_ = false;
80 80
83 83
84 void Transaction::Commit() 84 void Transaction::Commit()
85 { 85 {
86 if (!isOpen_) 86 if (!isOpen_)
87 { 87 {
88 throw PalanthirException("SQLite: Attempting to roll back a nonexistent transaction. " 88 throw OrthancException("SQLite: Attempting to roll back a nonexistent transaction. "
89 "Did you remember to call Begin()?"); 89 "Did you remember to call Begin()?");
90 } 90 }
91 91
92 isOpen_ = false; 92 isOpen_ = false;
93 93
94 if (!connection_.CommitTransaction()) 94 if (!connection_.CommitTransaction())
95 { 95 {
96 throw PalanthirException("SQLite: Failure when committing the transaction"); 96 throw OrthancException("SQLite: Failure when committing the transaction");
97 } 97 }
98 } 98 }
99 } 99 }
100 } 100 }