Mercurial > hg > orthanc-databases
comparison MySQL/Plugins/MySQLIndex.cpp @ 217:ee5858d438dc
TransactionType given to MySQLTransaction constructor
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 26 Mar 2021 18:02:34 +0100 |
parents | 2089d4071408 |
children | 73cc85f3d9c1 |
comparison
equal
deleted
inserted
replaced
216:fbb52129158a | 217:ee5858d438dc |
---|---|
95 * error message "MySQL plugin is incompatible with database | 95 * error message "MySQL plugin is incompatible with database |
96 * schema version: 0" that was reported in the forum: | 96 * schema version: 0" that was reported in the forum: |
97 * https://groups.google.com/d/msg/orthanc-users/OCFFkm1qm0k/Mbroy8VWAQAJ | 97 * https://groups.google.com/d/msg/orthanc-users/OCFFkm1qm0k/Mbroy8VWAQAJ |
98 **/ | 98 **/ |
99 { | 99 { |
100 MySQLTransaction t(*db); | 100 MySQLTransaction t(*db, TransactionType_ReadWrite); |
101 | 101 |
102 db->Execute("ALTER DATABASE " + parameters_.GetDatabase() + | 102 db->Execute("ALTER DATABASE " + parameters_.GetDatabase() + |
103 " CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci", false); | 103 " CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci", false); |
104 | 104 |
105 // This is the first table to be created | 105 // This is the first table to be created |
124 **/ | 124 **/ |
125 | 125 |
126 int version = 0; | 126 int version = 0; |
127 | 127 |
128 { | 128 { |
129 MySQLTransaction t(*db); | 129 MySQLTransaction t(*db, TransactionType_ReadWrite); |
130 | 130 |
131 // This is the last table to be created | 131 // This is the last table to be created |
132 if (!db->DoesTableExist(t, "PatientRecyclingOrder")) | 132 if (!db->DoesTableExist(t, "PatientRecyclingOrder")) |
133 { | 133 { |
134 LOG(ERROR) << "Corrupted MySQL database"; | 134 LOG(ERROR) << "Corrupted MySQL database"; |
158 } | 158 } |
159 | 159 |
160 int revision = 0; | 160 int revision = 0; |
161 | 161 |
162 { | 162 { |
163 MySQLTransaction t(*db); | 163 MySQLTransaction t(*db, TransactionType_ReadWrite); |
164 | 164 |
165 if (!LookupGlobalIntegerProperty(revision, *db, t, Orthanc::GlobalProperty_DatabasePatchLevel)) | 165 if (!LookupGlobalIntegerProperty(revision, *db, t, Orthanc::GlobalProperty_DatabasePatchLevel)) |
166 { | 166 { |
167 revision = 1; | 167 revision = 1; |
168 SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision); | 168 SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision); |
171 t.Commit(); | 171 t.Commit(); |
172 } | 172 } |
173 | 173 |
174 if (revision == 1) | 174 if (revision == 1) |
175 { | 175 { |
176 MySQLTransaction t(*db); | 176 MySQLTransaction t(*db, TransactionType_ReadWrite); |
177 | 177 |
178 // The serialization of jobs as a global property can lead to | 178 // The serialization of jobs as a global property can lead to |
179 // very long values => switch to the LONGTEXT type that can | 179 // very long values => switch to the LONGTEXT type that can |
180 // store up to 4GB: | 180 // store up to 4GB: |
181 // https://stackoverflow.com/a/13932834/881731 | 181 // https://stackoverflow.com/a/13932834/881731 |
187 t.Commit(); | 187 t.Commit(); |
188 } | 188 } |
189 | 189 |
190 if (revision == 2) | 190 if (revision == 2) |
191 { | 191 { |
192 MySQLTransaction t(*db); | 192 MySQLTransaction t(*db, TransactionType_ReadWrite); |
193 | 193 |
194 // Install the "GetLastChangeIndex" extension | 194 // Install the "GetLastChangeIndex" extension |
195 std::string query; | 195 std::string query; |
196 | 196 |
197 Orthanc::EmbeddedResources::GetFileResource | 197 Orthanc::EmbeddedResources::GetFileResource |
209 t.Commit(); | 209 t.Commit(); |
210 } | 210 } |
211 | 211 |
212 if (revision == 3) | 212 if (revision == 3) |
213 { | 213 { |
214 MySQLTransaction t(*db); | 214 MySQLTransaction t(*db, TransactionType_ReadWrite); |
215 | 215 |
216 // Reconfiguration of "Metadata" from TEXT type (up to 64KB) | 216 // Reconfiguration of "Metadata" from TEXT type (up to 64KB) |
217 // to the LONGTEXT type (up to 4GB). This might be important | 217 // to the LONGTEXT type (up to 4GB). This might be important |
218 // for applications such as the Osimis Web viewer that stores | 218 // for applications such as the Osimis Web viewer that stores |
219 // large amount of metadata. | 219 // large amount of metadata. |
226 t.Commit(); | 226 t.Commit(); |
227 } | 227 } |
228 | 228 |
229 if (revision == 4) | 229 if (revision == 4) |
230 { | 230 { |
231 MySQLTransaction t(*db); | 231 MySQLTransaction t(*db, TransactionType_ReadWrite); |
232 | 232 |
233 // Install the "CreateInstance" extension | 233 // Install the "CreateInstance" extension |
234 std::string query; | 234 std::string query; |
235 | 235 |
236 Orthanc::EmbeddedResources::GetFileResource | 236 Orthanc::EmbeddedResources::GetFileResource |