changeset 310:f3eac614b32e

fixed two DatabaseManager::CachedStatement in the same scope
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Jul 2021 17:23:54 +0200
parents d192bfd0e752
children 5f0d5f849944
files Framework/Plugins/IndexBackend.cpp
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/IndexBackend.cpp	Mon Jul 12 18:45:09 2021 +0200
+++ b/Framework/Plugins/IndexBackend.cpp	Tue Jul 13 17:23:54 2021 +0200
@@ -126,8 +126,8 @@
       output.AnswerChange(
         statement.ReadInteger64(0),
         statement.ReadInteger32(1),
-        static_cast<OrthancPluginResourceType>(statement.ReadInteger32(3)),
-        GetPublicId(manager, statement.ReadInteger64(2)),
+        static_cast<OrthancPluginResourceType>(statement.ReadInteger32(2)),
+        statement.ReadString(3),
         statement.ReadString(4));
 
       statement.Next();
@@ -571,7 +571,9 @@
     
     DatabaseManager::CachedStatement statement(
       STATEMENT_FROM_HERE, manager,
-      "SELECT * FROM Changes WHERE seq>${since} ORDER BY seq " + suffix);
+      "SELECT Changes.seq, Changes.changeType, Changes.resourceType, Changes.date, "
+      "Resources.publicId FROM Changes INNER JOIN Resources "
+      "ON Changes.internalId = Resources.internalId WHERE seq>${since} ORDER BY seq " + suffix);
 
     statement.SetReadOnly(true);
     statement.SetParameterType("limit", ValueType_Integer64);
@@ -672,7 +674,9 @@
 
     DatabaseManager::CachedStatement statement(
       STATEMENT_FROM_HERE, manager,
-      "SELECT * FROM Changes ORDER BY seq DESC " + suffix);
+      "SELECT Changes.seq, Changes.changeType, Changes.resourceType, Changes.date, "
+      "Resources.publicId FROM Changes INNER JOIN Resources "
+      "ON Changes.internalId = Resources.internalId ORDER BY seq DESC " + suffix);
 
     statement.SetReadOnly(true);
       
@@ -2011,6 +2015,7 @@
     {
       switch (dialect_)
       {
+        case Dialect_MSSQL:
         case Dialect_SQLite:
         case Dialect_PostgreSQL:
           return "ESCAPE '\\'";