changeset 385:346fe629d638 db-protobuf

clarifying types of since/limit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 03 Apr 2023 11:19:19 +0200
parents e236be67e5f9
children 0fed785e974e
files Framework/Plugins/IDatabaseBackend.h Framework/Plugins/IndexBackend.cpp Framework/Plugins/IndexBackend.h
diffstat 3 files changed, 24 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/IDatabaseBackend.h	Mon Apr 03 10:46:01 2023 +0200
+++ b/Framework/Plugins/IDatabaseBackend.h	Mon Apr 03 11:19:19 2023 +0200
@@ -92,15 +92,15 @@
     virtual void GetAllPublicIds(std::list<std::string>& target,
                                  DatabaseManager& manager,
                                  OrthancPluginResourceType resourceType,
-                                 uint64_t since,
-                                 uint64_t limit) = 0;
+                                 int64_t since,
+                                 uint32_t limit) = 0;
 
     /* Use GetOutput().AnswerChange() */
     virtual void GetChanges(IDatabaseBackendOutput& output,
                             bool& done /*out*/,
                             DatabaseManager& manager,
                             int64_t since,
-                            uint32_t maxResults) = 0;
+                            uint32_t limit) = 0;
 
     virtual void GetChildrenInternalId(std::list<int64_t>& target /*out*/,
                                        DatabaseManager& manager,
@@ -115,7 +115,7 @@
                                       bool& done /*out*/,
                                       DatabaseManager& manager,
                                       int64_t since,
-                                      uint32_t maxResults) = 0;
+                                      uint32_t limit) = 0;
 
     /* Use GetOutput().AnswerChange() */
     virtual void GetLastChange(IDatabaseBackendOutput& output,
--- a/Framework/Plugins/IndexBackend.cpp	Mon Apr 03 10:46:01 2023 +0200
+++ b/Framework/Plugins/IndexBackend.cpp	Mon Apr 03 11:19:19 2023 +0200
@@ -116,13 +116,13 @@
                                          DatabaseManager& manager,
                                          DatabaseManager::CachedStatement& statement,
                                          const Dictionary& args,
-                                         uint32_t maxResults)
+                                         uint32_t limit)
   {
     statement.Execute(args);
 
     uint32_t count = 0;
 
-    while (count < maxResults &&
+    while (count < limit &&
            !statement.IsDone())
     {
       output.AnswerChange(
@@ -136,7 +136,7 @@
       count++;
     }
 
-    done = (count < maxResults ||
+    done = (count < limit ||
             statement.IsDone());
   }
 
@@ -145,13 +145,13 @@
                                                    bool& done,
                                                    DatabaseManager::CachedStatement& statement,
                                                    const Dictionary& args,
-                                                   uint32_t maxResults)
+                                                   uint32_t limit)
   {
     statement.Execute(args);
 
     uint32_t count = 0;
 
-    while (count < maxResults &&
+    while (count < limit &&
            !statement.IsDone())
     {
       int64_t seq = statement.ReadInteger64(0);
@@ -173,7 +173,7 @@
       count++;
     }
 
-    done = (count < maxResults ||
+    done = (count < limit ||
             statement.IsDone());
   }
 
@@ -519,8 +519,8 @@
   void IndexBackend::GetAllPublicIds(std::list<std::string>& target,
                                      DatabaseManager& manager,
                                      OrthancPluginResourceType resourceType,
-                                     uint64_t since,
-                                     uint64_t limit)
+                                     int64_t since,
+                                     uint32_t limit)
   {
     std::string suffix;
     if (manager.GetDialect() == Dialect_MSSQL)
@@ -556,7 +556,7 @@
                                 bool& done /*out*/,
                                 DatabaseManager& manager,
                                 int64_t since,
-                                uint32_t maxResults)
+                                uint32_t limit)
   {
     std::string suffix;
     if (manager.GetDialect() == Dialect_MSSQL)
@@ -579,10 +579,10 @@
     statement.SetParameterType("since", ValueType_Integer64);
 
     Dictionary args;
-    args.SetIntegerValue("limit", maxResults + 1);
+    args.SetIntegerValue("limit", limit + 1);
     args.SetIntegerValue("since", since);
 
-    ReadChangesInternal(output, done, manager, statement, args, maxResults);
+    ReadChangesInternal(output, done, manager, statement, args, limit);
   }
 
     
@@ -629,7 +629,7 @@
                                           bool& done /*out*/,
                                           DatabaseManager& manager,
                                           int64_t since,
-                                          uint32_t maxResults)
+                                          uint32_t limit)
   {
     std::string suffix;
     if (manager.GetDialect() == Dialect_MSSQL)
@@ -650,10 +650,10 @@
     statement.SetParameterType("since", ValueType_Integer64);
 
     Dictionary args;
-    args.SetIntegerValue("limit", maxResults + 1);
+    args.SetIntegerValue("limit", limit + 1);
     args.SetIntegerValue("since", since);
 
-    ReadExportedResourcesInternal(output, done, statement, args, maxResults);
+    ReadExportedResourcesInternal(output, done, statement, args, limit);
   }
 
     
--- a/Framework/Plugins/IndexBackend.h	Mon Apr 03 10:46:01 2023 +0200
+++ b/Framework/Plugins/IndexBackend.h	Mon Apr 03 11:19:19 2023 +0200
@@ -62,13 +62,13 @@
                              DatabaseManager& manager,
                              DatabaseManager::CachedStatement& statement,
                              const Dictionary& args,
-                             uint32_t maxResults);
+                             uint32_t limit);
 
     void ReadExportedResourcesInternal(IDatabaseBackendOutput& output,
                                        bool& done,
                                        DatabaseManager::CachedStatement& statement,
                                        const Dictionary& args,
-                                       uint32_t maxResults);
+                                       uint32_t limit);
 
   public:
     explicit IndexBackend(OrthancPluginContext* context);
@@ -119,14 +119,14 @@
     virtual void GetAllPublicIds(std::list<std::string>& target,
                                  DatabaseManager& manager,
                                  OrthancPluginResourceType resourceType,
-                                 uint64_t since,
-                                 uint64_t limit) ORTHANC_OVERRIDE;
+                                 int64_t since,
+                                 uint32_t limit) ORTHANC_OVERRIDE;
     
     virtual void GetChanges(IDatabaseBackendOutput& output,
                             bool& done /*out*/,
                             DatabaseManager& manager,
                             int64_t since,
-                            uint32_t maxResults) ORTHANC_OVERRIDE;
+                            uint32_t limit) ORTHANC_OVERRIDE;
     
     virtual void GetChildrenInternalId(std::list<int64_t>& target /*out*/,
                                        DatabaseManager& manager,
@@ -140,7 +140,7 @@
                                       bool& done /*out*/,
                                       DatabaseManager& manager,
                                       int64_t since,
-                                      uint32_t maxResults) ORTHANC_OVERRIDE;
+                                      uint32_t limit) ORTHANC_OVERRIDE;
     
     virtual void GetLastChange(IDatabaseBackendOutput& output,
                                DatabaseManager& manager) ORTHANC_OVERRIDE;