diff OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp @ 5238:367e8af46cfd db-protobuf

added "HasLabels" in /system
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Apr 2023 10:02:19 +0200
parents cd2258ca7894
children 72dfa0ac84eb
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Wed Apr 05 09:07:47 2023 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Wed Apr 05 10:02:19 2023 +0200
@@ -1961,6 +1961,11 @@
       }
     };
 
+    if ((!withLabels.empty() || !withoutLabels.empty()) &&
+        !db_.HasLabelsSupport())
+    {
+      throw OrthancException(ErrorCode_NotImplemented, "The database backend doesn't support labels");
+    }
 
     std::vector<DatabaseConstraint> normalized;
     NormalizeLookup(normalized, lookup, queryLevel);
@@ -3630,4 +3635,11 @@
     Operations operations(publicId, level, label, operation);
     Apply(operations);
   }
+
+
+  bool StatelessDatabaseOperations::HasLabelsSupport()
+  {
+    boost::shared_lock<boost::shared_mutex> lock(mutex_);
+    return db_.HasLabelsSupport();
+  }
 }