diff OrthancServer/DatabaseWrapper.cpp @ 238:e4148b0ab1d0

statistics URI
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 30 Nov 2012 16:09:24 +0100
parents 16a4ac70bd8a
children bd009f0b1931
line wrap: on
line diff
--- a/OrthancServer/DatabaseWrapper.cpp	Fri Nov 30 15:45:15 2012 +0100
+++ b/OrthancServer/DatabaseWrapper.cpp	Fri Nov 30 16:09:24 2012 +0100
@@ -739,4 +739,21 @@
     db_.Register(signalRemainingAncestor_);
     db_.Register(new Internals::SignalFileDeleted(listener_));
   }
+
+  uint64_t DatabaseWrapper::GetResourceCount(ResourceType resourceType)
+  {
+    SQLite::Statement s(db_, SQLITE_FROM_HERE, 
+                        "SELECT COUNT(*) FROM Resources WHERE resourceType=?");
+    s.BindInt(0, resourceType);
+    
+    if (!s.Step())
+    {
+      throw OrthancException(ErrorCode_InternalError);
+    }
+
+    int64_t c = s.ColumnInt(0);
+    assert(!s.Step());
+
+    return c;
+  }
 }