diff OrthancServer/DatabaseWrapper.cpp @ 1006:649d47854314 lua-scripting

proper handling of metadata in Store
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 Jul 2014 15:11:00 +0200
parents 84513f2ee1f3
children badc14fee61f
line wrap: on
line diff
--- a/OrthancServer/DatabaseWrapper.cpp	Tue Jul 08 14:34:11 2014 +0200
+++ b/OrthancServer/DatabaseWrapper.cpp	Tue Jul 08 15:11:00 2014 +0200
@@ -1045,4 +1045,21 @@
       result.push_back(s.ColumnInt64(0));
     }
   }
+
+
+  void DatabaseWrapper::GetAllMetadata(std::map<MetadataType, std::string>& result,
+                                       int64_t id)
+  {
+    result.clear();
+
+    SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT type, value FROM Metadata WHERE id=?");
+    s.BindInt64(0, id);
+
+    while (s.Step())
+    {
+      MetadataType key = static_cast<MetadataType>(s.ColumnInt(0));
+      result[key] = s.ColumnString(1);
+    }
+  }
+
 }