# HG changeset patch # User Sebastien Jodogne # Date 1680875022 -7200 # Node ID 897253c21208b04cac420e237fc6d761e4bae7f1 # Parent 19bd3ee1f0b35d6cd1c71e996966fd06981a2100 support for labels in mysql diff -r 19bd3ee1f0b3 -r 897253c21208 Framework/Plugins/IndexBackend.cpp --- a/Framework/Plugins/IndexBackend.cpp Fri Apr 07 15:28:47 2023 +0200 +++ b/Framework/Plugins/IndexBackend.cpp Fri Apr 07 15:43:42 2023 +0200 @@ -2632,6 +2632,12 @@ "INSERT OR IGNORE INTO Labels VALUES(${id}, ${label})")); break; + case Dialect_MySQL: + statement.reset(new DatabaseManager::CachedStatement( + STATEMENT_FROM_HERE, manager, + "INSERT IGNORE INTO Labels VALUES(${id}, ${label})")); + break; + default: throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); } diff -r 19bd3ee1f0b3 -r 897253c21208 MySQL/NEWS --- a/MySQL/NEWS Fri Apr 07 15:28:47 2023 +0200 +++ b/MySQL/NEWS Fri Apr 07 15:43:42 2023 +0200 @@ -4,7 +4,7 @@ * Compatibility with Orthanc SDK 1.12.0 (communications between the Orthanc core and the database plugin using Google Protocol Buffers) * Upgraded dependencies for static builds (notably on Windows and LSB): - - openssl 3.0.1 + - openssl 3.1.0 Release 4.3 (2021-07-22) diff -r 19bd3ee1f0b3 -r 897253c21208 MySQL/Plugins/MySQLIndex.cpp --- a/MySQL/Plugins/MySQLIndex.cpp Fri Apr 07 15:28:47 2023 +0200 +++ b/MySQL/Plugins/MySQLIndex.cpp Fri Apr 07 15:43:42 2023 +0200 @@ -295,7 +295,27 @@ t.Commit(); } - if (revision != 6) + if (revision == 6) + { + // Added new table "Labels" since release 5.0 to deal with + // labels that were introduced in Orthanc 1.12.0 + DatabaseManager::Transaction t(manager, TransactionType_ReadWrite); + + t.GetDatabaseTransaction().ExecuteMultiLines( + "CREATE TABLE Labels(id BIGINT NOT NULL," + "label VARCHAR(64) NOT NULL," + "PRIMARY KEY(id, label)," + "CONSTRAINT Labels1 FOREIGN KEY (id) REFERENCES Resources(internalId) ON DELETE CASCADE);" + "CREATE INDEX LabelsIndex1 ON Labels(id);" + "CREATE INDEX LabelsIndex2 ON Labels(label);"); + + 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); diff -r 19bd3ee1f0b3 -r 897253c21208 MySQL/Plugins/MySQLIndex.h --- a/MySQL/Plugins/MySQLIndex.h Fri Apr 07 15:28:47 2023 +0200 +++ b/MySQL/Plugins/MySQLIndex.h Fri Apr 07 15:43:42 2023 +0200 @@ -80,7 +80,7 @@ // New primitive since Orthanc 1.12.0 virtual bool HasLabelsSupport() const ORTHANC_OVERRIDE { - return false; + return true; } }; } diff -r 19bd3ee1f0b3 -r 897253c21208 PostgreSQL/NEWS --- a/PostgreSQL/NEWS Fri Apr 07 15:28:47 2023 +0200 +++ b/PostgreSQL/NEWS Fri Apr 07 15:43:42 2023 +0200 @@ -4,7 +4,7 @@ * Compatibility with Orthanc SDK 1.12.0 (communications between the Orthanc core and the database plugin using Google Protocol Buffers) * Upgraded dependencies for static builds (notably on Windows and LSB): - - openssl 3.0.1 + - openssl 3.1.0 Release 4.0 (2021-04-22)