Mercurial > hg > orthanc-databases
diff MySQL/Plugins/MySQLIndex.cpp @ 366:cd9521e04249 attach-custom-data
DatabaseBackendAdapterV4: added support for customData + revision when not already done
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 15 Sep 2022 18:12:34 +0200 |
parents | eb0b04c10bc4 |
children | f18e46d7dbf8 |
line wrap: on
line diff
--- a/MySQL/Plugins/MySQLIndex.cpp Tue Jul 05 08:44:26 2022 +0200 +++ b/MySQL/Plugins/MySQLIndex.cpp Thu Sep 15 18:12:34 2022 +0200 @@ -294,7 +294,26 @@ t.Commit(); } - if (revision != 6) + if (revision == 6) + { + DatabaseManager::Transaction t(manager, TransactionType_ReadWrite); + + // Install revision and customData extension + std::string query; + + Orthanc::EmbeddedResources::GetFileResource + (query, Orthanc::EmbeddedResources::MYSQL_INSTALL_REVISION_AND_CUSTOM_DATA); + + // Need to escape arobases: Don't use "t.GetDatabaseTransaction().ExecuteMultiLines()" here + db.ExecuteMultiLines(query, true); + + revision = 7; + SetGlobalIntegerProperty(manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, revision); + + t.Commit(); + } + + if (revision != 7) { LOG(ERROR) << "MySQL plugin is incompatible with database schema revision: " << revision; throw Orthanc::OrthancException(Orthanc::ErrorCode_Database);