diff OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp @ 5227:988dab8deb1c db-protobuf

"/tools/find" accepts the "WithLabels" and "WithoutLabels" arguments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 Apr 2023 09:16:12 +0200
parents d0f7c742d397
children a7d95f951f8a
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp	Tue Apr 04 07:09:22 2023 +0200
+++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp	Tue Apr 04 09:16:12 2023 +0200
@@ -345,16 +345,10 @@
                                       const std::set<std::string>& withoutLabels,
                                       uint32_t limit) ORTHANC_OVERRIDE
     {
-      if (!withLabels.empty() ||
-          !withoutLabels.empty())
-      {
-        throw OrthancException(ErrorCode_NotImplemented);
-      }
-      
       LookupFormatter formatter;
 
       std::string sql;
-      LookupFormatter::Apply(sql, formatter, lookup, queryLevel, limit);
+      LookupFormatter::Apply(sql, formatter, lookup, queryLevel, withLabels, withoutLabels, limit);
 
       sql = "CREATE TEMPORARY TABLE Lookup AS " + sql;
     
@@ -1090,7 +1084,7 @@
       }
       else
       {
-        SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT INTO Labels (internalId, label) VALUES(?, ?)");
+        SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT OR IGNORE INTO Labels (internalId, label) VALUES(?, ?)");
         s.BindInt64(0, resource);
         s.BindString(1, label);
         s.Run();