diff OrthancServer/DatabaseWrapper.cpp @ 521:2c739f76d0bb

lookup tag values
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 29 Aug 2013 14:50:23 +0200
parents 935e8c7e0b18
children c2be0a0e049e b2357f1f026f
line wrap: on
line diff
--- a/OrthancServer/DatabaseWrapper.cpp	Tue Aug 20 13:39:42 2013 +0200
+++ b/OrthancServer/DatabaseWrapper.cpp	Thu Aug 29 14:50:23 2013 +0200
@@ -958,4 +958,41 @@
     s.BindInt(0, internalId);
     return s.Step();
   }
+
+
+  void  DatabaseWrapper::LookupTagValue(std::list<int64_t>& result,
+                                        DicomTag tag,
+                                        const std::string& value)
+  {
+    SQLite::Statement s(db_, SQLITE_FROM_HERE, 
+                        "SELECT id FROM MainDicomTags WHERE tagGroup=? AND tagElement=? and value=?");
+
+    s.BindInt(0, tag.GetGroup());
+    s.BindInt(1, tag.GetElement());
+    s.BindString(2, value);
+
+    result.clear();
+
+    while (s.Step())
+    {
+      result.push_back(s.ColumnInt64(0));
+    }
+  }
+
+
+  void  DatabaseWrapper::LookupTagValue(std::list<int64_t>& result,
+                                        const std::string& value)
+  {
+    SQLite::Statement s(db_, SQLITE_FROM_HERE, 
+                        "SELECT id FROM MainDicomTags WHERE value=?");
+
+    s.BindString(0, value);
+
+    result.clear();
+
+    while (s.Step())
+    {
+      result.push_back(s.ColumnInt64(0));
+    }
+  }
 }