diff OrthancFramework/Sources/SQLite/StatementId.cpp @ 5566:8b507b1514eb find-refactoring

cache dynamic SQLite statements (imported from large-queries branch)
author Alain Mazy <am@orthanc.team>
date Tue, 23 Apr 2024 14:37:11 +0200
parents 48b8dae6dc77
children 3f13db27b399
line wrap: on
line diff
--- a/OrthancFramework/Sources/SQLite/StatementId.cpp	Tue Apr 23 13:07:38 2024 +0200
+++ b/OrthancFramework/Sources/SQLite/StatementId.cpp	Tue Apr 23 14:37:11 2024 +0200
@@ -56,12 +56,24 @@
     {
     }
 
+    Orthanc::SQLite::StatementId::StatementId(const char *file,
+                                              int line,
+                                              const std::string& statement) :
+      file_(file),
+      line_(line),
+      statement_(statement)
+    {
+    }
+
     bool StatementId::operator< (const StatementId& other) const
     {
       if (line_ != other.line_)
         return line_ < other.line_;
 
-      return strcmp(file_, other.file_) < 0;
+      if (strcmp(file_, other.file_) < 0)
+        return true;
+
+      return statement_ < other.statement_;
     }
   }
 }