Mercurial > hg > orthanc-databases
annotate MySQL/Plugins/MySQLStorageArea.cpp @ 342:3451026ce7d0 OrthancMySQL-4.2
closing OrthancMySQL-4.2
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 12 Aug 2021 16:08:44 +0200 |
parents | 567761f0c1ea |
children | 16aac0287485 |
rev | line source |
---|---|
17 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
193
3236894320d6
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
157
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
17 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #include "MySQLStorageArea.h" | |
23 | |
242
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
24 #include "../../Framework/Common/BinaryStringValue.h" |
17 | 25 #include "../../Framework/MySQL/MySQLDatabase.h" |
26 #include "../../Framework/MySQL/MySQLTransaction.h" | |
137
52b3859ee0b7
MySQL: acquiring named locks instead of numbers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
27 #include "MySQLDefinitions.h" |
17 | 28 |
157
275e14f57f1e
replacing deprecated std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
29 #include <Compatibility.h> // For std::unique_ptr<> |
152 | 30 #include <Logging.h> |
17 | 31 |
32 #include <boost/math/special_functions/round.hpp> | |
33 | |
34 | |
35 namespace OrthancDatabases | |
36 { | |
226
a4918d57435c
DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
37 void MySQLStorageArea::ConfigureDatabase(MySQLDatabase& db, |
a4918d57435c
DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
38 const MySQLParameters& parameters, |
a4918d57435c
DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
39 bool clearAll) |
17 | 40 { |
41 { | |
226
a4918d57435c
DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
42 MySQLDatabase::TransientAdvisoryLock lock(db, MYSQL_LOCK_DATABASE_SETUP); |
a4918d57435c
DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
43 MySQLTransaction t(db, TransactionType_ReadWrite); |
17 | 44 |
45 int64_t size; | |
226
a4918d57435c
DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
46 if (db.LookupGlobalIntegerVariable(size, "max_allowed_packet")) |
17 | 47 { |
48 int mb = boost::math::iround(static_cast<double>(size) / | |
49 static_cast<double>(1024 * 1024)); | |
50 LOG(WARNING) << "Your MySQL server cannot " | |
51 << "store DICOM files larger than " << mb << "MB"; | |
52 LOG(WARNING) << " => Consider increasing \"max_allowed_packet\" " | |
53 << "in \"my.cnf\" if this limit is insufficient for your use"; | |
54 } | |
55 else | |
56 { | |
57 LOG(WARNING) << "Unable to auto-detect the maximum size of DICOM " | |
58 << "files that can be stored in this MySQL server"; | |
59 } | |
60 | |
226
a4918d57435c
DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
61 if (clearAll) |
17 | 62 { |
237
35598014f140
refactoring to remove GlobalProperties.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
63 db.ExecuteMultiLines("DROP TABLE IF EXISTS StorageArea", false); |
17 | 64 } |
65 | |
237
35598014f140
refactoring to remove GlobalProperties.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
66 db.ExecuteMultiLines("CREATE TABLE IF NOT EXISTS StorageArea(" |
35598014f140
refactoring to remove GlobalProperties.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
67 "uuid VARCHAR(64) NOT NULL PRIMARY KEY," |
35598014f140
refactoring to remove GlobalProperties.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
68 "content LONGBLOB NOT NULL," |
35598014f140
refactoring to remove GlobalProperties.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
69 "type INTEGER NOT NULL)", false); |
17 | 70 |
71 t.Commit(); | |
72 } | |
73 | |
137
52b3859ee0b7
MySQL: acquiring named locks instead of numbers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
74 /** |
52b3859ee0b7
MySQL: acquiring named locks instead of numbers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
75 * WARNING: This lock must be acquired after |
52b3859ee0b7
MySQL: acquiring named locks instead of numbers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
76 * "MYSQL_LOCK_DATABASE_SETUP" is released. Indeed, in MySQL < |
52b3859ee0b7
MySQL: acquiring named locks instead of numbers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
77 * 5.7, it is impossible to acquire more than one lock at a time, |
52b3859ee0b7
MySQL: acquiring named locks instead of numbers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
78 * as calling "SELECT GET_LOCK()" releases all the |
52b3859ee0b7
MySQL: acquiring named locks instead of numbers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
79 * previously-acquired locks. |
52b3859ee0b7
MySQL: acquiring named locks instead of numbers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
80 * https://dev.mysql.com/doc/refman/5.7/en/locking-functions.html |
52b3859ee0b7
MySQL: acquiring named locks instead of numbers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
81 **/ |
226
a4918d57435c
DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
82 if (parameters.HasLock()) |
137
52b3859ee0b7
MySQL: acquiring named locks instead of numbers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
83 { |
226
a4918d57435c
DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
84 db.AdvisoryLock(MYSQL_LOCK_STORAGE); |
137
52b3859ee0b7
MySQL: acquiring named locks instead of numbers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
85 } |
17 | 86 } |
87 | |
88 | |
226
a4918d57435c
DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
89 MySQLStorageArea::MySQLStorageArea(const MySQLParameters& parameters, |
255
d663d9e44f8d
reintroduction of IDatabaseFactory into DatabaseManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
252
diff
changeset
|
90 bool clearAll) : |
269
567761f0c1ea
fix issue #151: support of retries in the storage area plugins to deal with multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
255
diff
changeset
|
91 StorageBackend(MySQLDatabase::CreateDatabaseFactory(parameters), |
567761f0c1ea
fix issue #151: support of retries in the storage area plugins to deal with multiple writers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
255
diff
changeset
|
92 parameters.GetMaxConnectionRetries()) |
17 | 93 { |
226
a4918d57435c
DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
94 { |
255
d663d9e44f8d
reintroduction of IDatabaseFactory into DatabaseManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
252
diff
changeset
|
95 AccessorBase accessor(*this); |
d663d9e44f8d
reintroduction of IDatabaseFactory into DatabaseManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
252
diff
changeset
|
96 MySQLDatabase& database = dynamic_cast<MySQLDatabase&>(accessor.GetManager().GetDatabase()); |
d663d9e44f8d
reintroduction of IDatabaseFactory into DatabaseManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
252
diff
changeset
|
97 ConfigureDatabase(database, parameters, clearAll); |
226
a4918d57435c
DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
98 } |
17 | 99 } |
242
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
100 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
101 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
102 class MySQLStorageArea::Accessor : public StorageBackend::AccessorBase |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
103 { |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
104 public: |
252 | 105 explicit Accessor(MySQLStorageArea& backend) : |
242
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
106 AccessorBase(backend) |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
107 { |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
108 } |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
109 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
110 virtual void ReadRange(IFileContentVisitor& visitor, |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
111 const std::string& uuid, |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
112 OrthancPluginContentType type, |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
113 uint64_t start, |
250 | 114 size_t length) ORTHANC_OVERRIDE |
242
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
115 { |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
116 DatabaseManager::Transaction transaction(GetManager(), TransactionType_ReadOnly); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
117 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
118 { |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
119 // https://stackoverflow.com/a/6545557/881731 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
120 DatabaseManager::CachedStatement statement( |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
121 STATEMENT_FROM_HERE, GetManager(), |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
122 "SELECT SUBSTRING(content, ${start}, ${length}) FROM StorageArea WHERE uuid=${uuid} AND type=${type}"); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
123 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
124 statement.SetParameterType("uuid", ValueType_Utf8String); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
125 statement.SetParameterType("type", ValueType_Integer64); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
126 statement.SetParameterType("start", ValueType_Integer64); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
127 statement.SetParameterType("length", ValueType_Integer64); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
128 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
129 Dictionary args; |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
130 args.SetUtf8Value("uuid", uuid); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
131 args.SetIntegerValue("type", type); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
132 args.SetIntegerValue("length", length); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
133 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
134 /** |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
135 * "For all forms of SUBSTRING(), the position of the first |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
136 * character in the string from which the substring is to be |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
137 * extracted is reckoned as 1." => hence the "+ 1" |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
138 * https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_substring |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
139 **/ |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
140 args.SetIntegerValue("start", start + 1); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
141 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
142 statement.Execute(args); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
143 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
144 if (statement.IsDone()) |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
145 { |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
146 throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
147 } |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
148 else if (statement.GetResultFieldsCount() != 1) |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
149 { |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
150 throw Orthanc::OrthancException(Orthanc::ErrorCode_Database); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
151 } |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
152 else |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
153 { |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
154 const IValue& value = statement.GetResultField(0); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
155 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
156 if (value.GetType() == ValueType_BinaryString) |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
157 { |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
158 const std::string& content = dynamic_cast<const BinaryStringValue&>(value).GetContent(); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
159 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
160 if (static_cast<uint64_t>(content.size()) == length) |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
161 { |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
162 visitor.Assign(content); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
163 } |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
164 else |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
165 { |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
166 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadRange); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
167 } |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
168 } |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
169 else |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
170 { |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
171 throw Orthanc::OrthancException(Orthanc::ErrorCode_Database); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
172 } |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
173 } |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
174 } |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
175 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
176 transaction.Commit(); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
177 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
178 if (!visitor.IsSuccess()) |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
179 { |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
180 throw Orthanc::OrthancException(Orthanc::ErrorCode_Database, "Could not read range from the storage area"); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
181 } |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
182 } |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
183 }; |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
184 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
185 |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
186 StorageBackend::IAccessor* MySQLStorageArea::CreateAccessor() |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
187 { |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
188 return new Accessor(*this); |
b97a537f4613
MySQL: Support of range reads for the storage area
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
237
diff
changeset
|
189 } |
17 | 190 } |