Mercurial > hg > orthanc-databases
annotate Framework/SQLite/SQLiteTransaction.cpp @ 370:d2b5d9c92214 pg-transactions
PG: test feature: configurable transaction isolation level
author | Alain Mazy <am@osimis.io> |
---|---|
date | Wed, 22 Feb 2023 16:52:04 +0100 |
parents | 16aac0287485 |
children | 3d6886f3e5b3 |
rev | line source |
---|---|
0 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
359
16aac0287485
copyright upgraded to 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
16aac0287485
copyright upgraded to 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
0 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU Affero General Public License | |
10 * as published by the Free Software Foundation, either version 3 of | |
11 * the License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * Affero General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU Affero General Public License | |
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
23 #include "SQLiteTransaction.h" | |
24 | |
25 #include "SQLiteResult.h" | |
26 #include "SQLiteStatement.h" | |
27 | |
157
275e14f57f1e
replacing deprecated std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
28 #include <Compatibility.h> // For std::unique_ptr<> |
152 | 29 #include <OrthancException.h> |
0 | 30 |
31 namespace OrthancDatabases | |
32 { | |
33 SQLiteTransaction::SQLiteTransaction(SQLiteDatabase& database) : | |
237
35598014f140
refactoring to remove GlobalProperties.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
214
diff
changeset
|
34 database_(database), |
214
ab96698c73a3
removed useless information about read-only in ITransaction and IPrecompiledStatement
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
193
diff
changeset
|
35 transaction_(database.GetObject()) |
0 | 36 { |
37 transaction_.Begin(); | |
38 | |
39 if (!transaction_.IsOpen()) | |
40 { | |
41 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); | |
42 } | |
43 } | |
44 | |
45 IResult* SQLiteTransaction::Execute(IPrecompiledStatement& statement, | |
46 const Dictionary& parameters) | |
47 { | |
214
ab96698c73a3
removed useless information about read-only in ITransaction and IPrecompiledStatement
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
193
diff
changeset
|
48 return dynamic_cast<SQLiteStatement&>(statement).Execute(*this, parameters); |
0 | 49 } |
50 | |
51 void SQLiteTransaction::ExecuteWithoutResult(IPrecompiledStatement& statement, | |
52 const Dictionary& parameters) | |
53 { | |
54 dynamic_cast<SQLiteStatement&>(statement).ExecuteWithoutResult(*this, parameters); | |
55 } | |
56 } |