changeset 427:3cdea26ece73 pg-transactions

merge default -> pg-transactions
author Alain Mazy <am@osimis.io>
date Wed, 29 Nov 2023 10:24:18 +0100
parents a7f0f27fe33c (current diff) d700c8f9fc24 (diff)
children 4d0bacbd0fba
files PostgreSQL/NEWS PostgreSQL/Plugins/PostgreSQLIndex.cpp
diffstat 26 files changed, 159 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/GlobalProperties.h	Tue Jun 27 15:17:39 2023 +0200
+++ b/Framework/Plugins/GlobalProperties.h	Wed Nov 29 10:24:18 2023 +0100
@@ -31,7 +31,7 @@
    * The enum "GlobalProperty" is a subset of the "GlobalProperty_XXX"
    * values from the Orthanc server that have a special meaning to the
    * database plugins:
-   * https://hg.orthanc-server.com/orthanc/file/default/OrthancServer/Sources/ServerEnumerations.h
+   * https://orthanc.uclouvain.be/hg/orthanc/file/default/OrthancServer/Sources/ServerEnumerations.h
    *
    * WARNING: The values must be the same between the Orthanc core and
    * this enum!
--- a/Framework/Plugins/IndexBackend.cpp	Tue Jun 27 15:17:39 2023 +0200
+++ b/Framework/Plugins/IndexBackend.cpp	Wed Nov 29 10:24:18 2023 +0100
@@ -2036,7 +2036,7 @@
     virtual bool IsEscapeBrackets() const
     {
       // This was initially done at a bad location by the following changeset:
-      // https://hg.orthanc-server.com/orthanc-databases/rev/389c037387ea
+      // https://orthanc.uclouvain.be/hg/orthanc-databases/rev/389c037387ea
       return (dialect_ == Dialect_MSSQL);
     }
 
--- a/Framework/Plugins/IndexUnitTests.h	Tue Jun 27 15:17:39 2023 +0200
+++ b/Framework/Plugins/IndexUnitTests.h	Wed Nov 29 10:24:18 2023 +0100
@@ -57,7 +57,7 @@
   /**
    * Mock enumeration inspired from the source code of Orthanc... only
    * for use in the unit tests!
-   * https://hg.orthanc-server.com/orthanc/file/default/OrthancServer/Sources/ServerEnumerations.h
+   * https://orthanc.uclouvain.be/hg/orthanc/file/default/OrthancServer/Sources/ServerEnumerations.h
    **/
   enum MetadataType
   {
--- a/MySQL/CMakeLists.txt	Tue Jun 27 15:17:39 2023 +0200
+++ b/MySQL/CMakeLists.txt	Wed Nov 29 10:24:18 2023 +0100
@@ -130,6 +130,9 @@
 
 add_dependencies(FrameworkForPlugins AutogeneratedTarget)
 
+DefineSourceBasenameForTarget(OrthancMySQLIndex)
+DefineSourceBasenameForTarget(OrthancMySQLStorage)
+
 target_link_libraries(OrthancMySQLIndex FrameworkForPlugins)
 target_link_libraries(OrthancMySQLStorage FrameworkForPlugins)
 
--- a/MySQL/NEWS	Tue Jun 27 15:17:39 2023 +0200
+++ b/MySQL/NEWS	Wed Nov 29 10:24:18 2023 +0100
@@ -1,8 +1,7 @@
-Pending changes in the mainline
-===============================
+Release 5.1 (2023-06-27)
+========================
 
 * Optimization of LookupResources mainly used in tools/find, C-Find and QIDO-RS.
-  The optimization mainly affects find at study level.
 
 
 Release 5.0 (2023-04-16)
--- a/MySQL/Plugins/MySQLIndex.cpp	Tue Jun 27 15:17:39 2023 +0200
+++ b/MySQL/Plugins/MySQLIndex.cpp	Wed Nov 29 10:24:18 2023 +0100
@@ -237,7 +237,7 @@
         // to the LONGTEXT type (up to 4GB). This might be important
         // for applications such as the Osimis Web viewer that stores
         // large amount of metadata.
-        // http://book.orthanc-server.com/faq/features.html#central-registry-of-metadata-and-attachments
+        // https://orthanc.uclouvain.be/book/faq/features.html#central-registry-of-metadata-and-attachments
         t.GetDatabaseTransaction().ExecuteMultiLines("ALTER TABLE Metadata MODIFY value LONGTEXT");
         
         revision = 4;
--- a/Odbc/CMakeLists.txt	Tue Jun 27 15:17:39 2023 +0200
+++ b/Odbc/CMakeLists.txt	Wed Nov 29 10:24:18 2023 +0100
@@ -150,6 +150,9 @@
   COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1
   )
 
+DefineSourceBasenameForTarget(OrthancOdbcIndex)
+DefineSourceBasenameForTarget(OrthancOdbcStorage)
+
 install(
   TARGETS OrthancOdbcIndex OrthancOdbcStorage
   RUNTIME DESTINATION lib    # Destination for Windows
@@ -174,3 +177,5 @@
 set_target_properties(UnitTests PROPERTIES
   COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=0
   )
+
+DefineSourceBasenameForTarget(UnitTests)
\ No newline at end of file
--- a/Odbc/NEWS	Tue Jun 27 15:17:39 2023 +0200
+++ b/Odbc/NEWS	Wed Nov 29 10:24:18 2023 +0100
@@ -2,7 +2,6 @@
 ===============================
 
 * Optimization of LookupResources mainly used in tools/find, C-Find and QIDO-RS.
-  The optimization mainly affects find at study level.
 * Added support for labels
 * Compatibility with Orthanc SDK 1.12.0 (communications between the
   Orthanc core and the database plugin using Google Protocol Buffers)
--- a/PostgreSQL/CMakeLists.txt	Tue Jun 27 15:17:39 2023 +0200
+++ b/PostgreSQL/CMakeLists.txt	Wed Nov 29 10:24:18 2023 +0100
@@ -155,6 +155,10 @@
   COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1
   )
 
+DefineSourceBasenameForTarget(OrthancPostgreSQLIndex)
+DefineSourceBasenameForTarget(OrthancPostgreSQLStorage)
+ 
+
 install(
   TARGETS OrthancPostgreSQLIndex OrthancPostgreSQLStorage
   RUNTIME DESTINATION lib    # Destination for Windows
@@ -178,3 +182,5 @@
 set_target_properties(UnitTests PROPERTIES
   COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=0
   )
+
+DefineSourceBasenameForTarget(UnitTests)
--- a/PostgreSQL/NEWS	Tue Jun 27 15:17:39 2023 +0200
+++ b/PostgreSQL/NEWS	Wed Nov 29 10:24:18 2023 +0100
@@ -1,5 +1,5 @@
-Pending changes in the mainline
-===============================
+Release 5.1 (2023-06-27)
+========================
 
 * Experimental debug feature:
   Introduced 2 new configurations with these default values:
@@ -13,7 +13,6 @@
   - Added an advisory lock around CreateInstance
 
 * Optimization of LookupResources mainly used in tools/find, C-Find and QIDO-RS.
-  The optimization mainly affects find at study level.
 
 Release 5.0 (2023-04-15)
 ========================
@@ -34,7 +33,7 @@
 * Support of multiple readers/writers, by handling retries from Orthanc SDK 1.9.2
 * Support of range reads for the storage area, from Orthanc SDK 1.9.0
 * Fix issue #193 (LSB binaries crash with PostgreSQL + SSL) by changeset
-  in OrthancFramework: https://hg.orthanc-server.com/orthanc/rev/9a9118406484
+  in OrthancFramework: https://orthanc.uclouvain.be/hg/orthanc/rev/9a9118406484
 * Fix issue #151 (Storage failures when running with two instances and PG_LOCK=false)
 
 
--- a/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Tue Jun 27 15:17:39 2023 +0200
+++ b/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Wed Nov 29 10:24:18 2023 +0100
@@ -167,7 +167,7 @@
            * performance for "strict" searches (i.e. searches involving
            * no wildcard).
            * https://www.postgresql.org/docs/current/static/pgtrgm.html
-           * https://bugs.orthanc-server.com/show_bug.cgi?id=47
+           * https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=47
            **/
           try
           {
--- a/README	Tue Jun 27 15:17:39 2023 +0200
+++ b/README	Wed Nov 29 10:24:18 2023 +0100
@@ -24,7 +24,7 @@
 (.tar.gz) focused on one given RDBMS, you will only find the folders
 that are related to this specific RDBMS. The full source code is
 available at:
-https://hg.orthanc-server.com/orthanc-databases/
+https://orthanc.uclouvain.be/hg/orthanc-databases/
 
 
 Compilation and usage
@@ -33,9 +33,9 @@
 The compilation and usage of the plugins is available in the Orthanc
 Book:
 
-* MySQL/MariaDB : http://book.orthanc-server.com/plugins/mysql.html
-* PostgreSQL    : http://book.orthanc-server.com/plugins/postgresql.html
-* ODBC          : http://book.orthanc-server.com/plugins/odbc.html
+* MySQL/MariaDB : https://orthanc.uclouvain.be/book/plugins/mysql.html
+* PostgreSQL    : https://orthanc.uclouvain.be/book/plugins/postgresql.html
+* ODBC          : https://orthanc.uclouvain.be/book/plugins/odbc.html
 
 
 Older releases of PostgreSQL
@@ -46,7 +46,15 @@
 
 Releases <= 2.1 of the PostgreSQL plugins can still be found in the
 following legacy repository:
-https://hg.orthanc-server.com/orthanc-postgresql/
+https://orthanc.uclouvain.be/hg/orthanc-postgresql/
+
+
+Contributing
+------------
+
+Instructions for contributing to the Orthanc project are included in
+the Orthanc Book:
+https://orthanc.uclouvain.be/book/developers/repositories.html
 
 
 Licensing
--- a/Resources/CMake/MariaDBConfiguration.cmake	Tue Jun 27 15:17:39 2023 +0200
+++ b/Resources/CMake/MariaDBConfiguration.cmake	Wed Nov 29 10:24:18 2023 +0100
@@ -25,7 +25,7 @@
   set(MARIADB_PACKAGE_VERSION "3.1.11")
   set(MARIADB_CLIENT_SOURCES_DIR ${CMAKE_BINARY_DIR}/mariadb-connector-c-${MARIADB_PACKAGE_VERSION}-src)
   set(MARIADB_CLIENT_MD5 "cf9da5f0ac9ec72dd8309bdc1d1c6c2f")
-  set(MARIADB_CLIENT_URL "https://orthanc.uclouvain.be/third-party-downloads/mariadb-connector-c-${MARIADB_PACKAGE_VERSION}-src.tar.gz")
+  set(MARIADB_CLIENT_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/mariadb-connector-c-${MARIADB_PACKAGE_VERSION}-src.tar.gz")
 
   if (IS_DIRECTORY "${MARIADB_CLIENT_SOURCES_DIR}")
     set(FirstRun OFF)
--- a/Resources/CMake/PostgreSQLConfiguration.cmake	Tue Jun 27 15:17:39 2023 +0200
+++ b/Resources/CMake/PostgreSQLConfiguration.cmake	Wed Nov 29 10:24:18 2023 +0100
@@ -54,7 +54,7 @@
   SET(LIBPQ_SOURCES_DIR ${CMAKE_BINARY_DIR}/postgresql-${LIBPQ_VERSION})
   DownloadPackage(
     "551302a823a1ab48b4ed14166beebba9"
-    "https://orthanc.uclouvain.be/third-party-downloads/postgresql-${LIBPQ_VERSION}.tar.gz"
+    "https://orthanc.uclouvain.be/downloads/third-party-downloads/postgresql-${LIBPQ_VERSION}.tar.gz"
     "${LIBPQ_SOURCES_DIR}")
 
   
--- a/Resources/CMake/UnixOdbcConfiguration.cmake	Tue Jun 27 15:17:39 2023 +0200
+++ b/Resources/CMake/UnixOdbcConfiguration.cmake	Wed Nov 29 10:24:18 2023 +0100
@@ -25,7 +25,7 @@
   set(VERSION "2.3.9")  # Used in "config.h.in"
   set(UNIX_ODBC_SOURCES_DIR ${CMAKE_BINARY_DIR}/unixODBC-${VERSION})
   set(UNIX_ODBC_MD5 "06f76e034bb41df5233554abe961a16f")
-  set(UNIX_ODBC_URL "https://orthanc.uclouvain.be/third-party-downloads/unixODBC-${VERSION}.tar.gz")
+  set(UNIX_ODBC_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/unixODBC-${VERSION}.tar.gz")
 
   DownloadPackage(${UNIX_ODBC_MD5} ${UNIX_ODBC_URL} "${UNIX_ODBC_SOURCES_DIR}")
 
--- a/Resources/Orthanc/CMake/Compiler.cmake	Tue Jun 27 15:17:39 2023 +0200
+++ b/Resources/Orthanc/CMake/Compiler.cmake	Wed Nov 29 10:24:18 2023 +0100
@@ -263,3 +263,24 @@
   # preceding batches. https://cmake.org/Bug/view.php?id=14874
   set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> <LINK_FLAGS> q <TARGET> <OBJECTS>")
 endif()
+
+
+# This function defines macro "__ORTHANC_FILE__" as a replacement to
+# macro "__FILE__", as the latter leaks the full path of the source
+# files in the binaries
+# https://stackoverflow.com/questions/8487986/file-macro-shows-full-path
+# https://twitter.com/wget42/status/1676877802375634944?s=20
+function(DefineSourceBasenameForTarget targetname)
+  # Microsoft Visual Studio is extremely slow if using
+  # "set_property()", we only enable this feature for gcc and clang
+  if (CMAKE_COMPILER_IS_GNUCXX OR
+      CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+    get_target_property(source_files "${targetname}" SOURCES)
+    foreach(sourcefile ${source_files})
+      get_filename_component(basename "${sourcefile}" NAME)
+      set_property(
+        SOURCE "${sourcefile}" APPEND
+        PROPERTY COMPILE_DEFINITIONS "__ORTHANC_FILE__=\"${basename}\"")
+    endforeach()
+  endif()
+endfunction()
--- a/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake	Tue Jun 27 15:17:39 2023 +0200
+++ b/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake	Wed Nov 29 10:24:18 2023 +0100
@@ -153,9 +153,11 @@
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.11.2")
         set(ORTHANC_FRAMEWORK_MD5 "ede3de356493a8868545f8cb4b8bc8b5")
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.11.3")
-        set(ORTHANC_FRAMEWORK_MD5 "5c1b11009d782f248739919db6bf7f7a")
+        set(ORTHANC_FRAMEWORK_MD5 "f941c0f5771db7616e7b7961026a60e2")
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.0")
         set(ORTHANC_FRAMEWORK_MD5 "d32a0cde03b6eb603d8dd2b33d38bf1b")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.1")
+        set(ORTHANC_FRAMEWORK_MD5 "8a435140efc8ff4a01d8242f092f21de")
 
       # Below this point are development snapshots that were used to
       # release some plugin, before an official release of the Orthanc
@@ -166,19 +168,28 @@
       #
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "ae0e3fd609df")
         # DICOMweb 1.1 (framework pre-1.6.0)
+        set(ORTHANC_FRAMEWORK_PRE_RELEASE ON)
         set(ORTHANC_FRAMEWORK_MD5 "7e09e9b530a2f527854f0b782d7e0645")
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "82652c5fc04f")
         # Stone Web viewer 1.0 (framework pre-1.8.1)
+        set(ORTHANC_FRAMEWORK_PRE_RELEASE ON)
         set(ORTHANC_FRAMEWORK_MD5 "d77331d68917e66a3f4f9b807bbdab7f")
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "4a3ba4bf4ba7")
         # PostgreSQL 3.3 (framework pre-1.8.2)
+        set(ORTHANC_FRAMEWORK_PRE_RELEASE ON)
         set(ORTHANC_FRAMEWORK_MD5 "2d82bddf06f9cfe82095495cb3b8abde")
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "23ad1b9c7800")
         # For "Toolbox::ReadJson()" and "Toolbox::Write{...}Json()" (pre-1.9.0)
+        set(ORTHANC_FRAMEWORK_PRE_RELEASE ON)
         set(ORTHANC_FRAMEWORK_MD5 "9af92080e57c60dd288eba46ce606c00")
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "b2e08d83e21d")
         # WSI 1.1 (framework pre-1.10.0), to remove "-std=c++11"
+        set(ORTHANC_FRAMEWORK_PRE_RELEASE ON)
         set(ORTHANC_FRAMEWORK_MD5 "2eaa073cbb4b44ffba199ad93393b2b1")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "daf4807631c5")
+        # DICOMweb 1.15 (framework pre-1.12.2)
+        set(ORTHANC_FRAMEWORK_PRE_RELEASE ON)
+        set(ORTHANC_FRAMEWORK_MD5 "c644aff2817306b3207c98c92e43f35f")
       endif()
     endif()
   endif()
@@ -266,7 +277,7 @@
   else()
     message("Forking the Orthanc source repository using Mercurial")
     execute_process(
-      COMMAND ${ORTHANC_FRAMEWORK_HG} clone "https://hg.orthanc-server.com/orthanc/"
+      COMMAND ${ORTHANC_FRAMEWORK_HG} clone "https://orthanc.uclouvain.be/hg/orthanc/"
       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
       RESULT_VARIABLE Failure
       )    
@@ -315,7 +326,11 @@
   else()
     # Default case: Download from the official Web site
     set(ORTHANC_FRAMEMORK_FILENAME Orthanc-${ORTHANC_FRAMEWORK_VERSION}.tar.gz)
-    set(ORTHANC_FRAMEWORK_URL "https://orthanc.uclouvain.be/third-party-downloads/orthanc-framework/${ORTHANC_FRAMEMORK_FILENAME}")
+    if (ORTHANC_FRAMEWORK_PRE_RELEASE)
+      set(ORTHANC_FRAMEWORK_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/orthanc-framework/${ORTHANC_FRAMEMORK_FILENAME}")
+    else()
+      set(ORTHANC_FRAMEWORK_URL "https://orthanc.uclouvain.be/downloads/sources/orthanc/${ORTHANC_FRAMEMORK_FILENAME}")
+    endif()
   endif()
 
   set(ORTHANC_FRAMEWORK_ARCHIVE "${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${ORTHANC_FRAMEMORK_FILENAME}")
--- a/Resources/Orthanc/CMake/DownloadPackage.cmake	Tue Jun 27 15:17:39 2023 +0200
+++ b/Resources/Orthanc/CMake/DownloadPackage.cmake	Wed Nov 29 10:24:18 2023 +0100
@@ -101,19 +101,26 @@
       message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON")
     endif()
 
-    if ("${MD5}" STREQUAL "no-check")
-      message(WARNING "Not checking the MD5 of: ${Url}")
-      file(DOWNLOAD "${Url}" "${TMP_PATH}"
-        SHOW_PROGRESS TIMEOUT 300 INACTIVITY_TIMEOUT 60
-        STATUS Failure)
-    else()
-      file(DOWNLOAD "${Url}" "${TMP_PATH}"
-        SHOW_PROGRESS TIMEOUT 300 INACTIVITY_TIMEOUT 60
-        EXPECTED_MD5 "${MD5}" STATUS Failure)
-    endif()
+    foreach (retry RANGE 1 5)   # Retries 5 times
+      if ("${MD5}" STREQUAL "no-check")
+        message(WARNING "Not checking the MD5 of: ${Url}")
+        file(DOWNLOAD "${Url}" "${TMP_PATH}"
+          SHOW_PROGRESS TIMEOUT 30 INACTIVITY_TIMEOUT 10
+          STATUS Failure)
+      else()
+        file(DOWNLOAD "${Url}" "${TMP_PATH}"
+          SHOW_PROGRESS TIMEOUT 30 INACTIVITY_TIMEOUT 10
+          EXPECTED_MD5 "${MD5}" STATUS Failure)
+      endif()
 
-    list(GET Failure 0 Status)
+      list(GET Failure 0 Status)
+      if (Status EQUAL 0)
+        break()  # Successful download
+      endif()
+    endforeach()
+
     if (NOT Status EQUAL 0)
+      file(REMOVE ${TMP_PATH})
       message(FATAL_ERROR "Cannot download file: ${Url}")
     endif()
     
--- a/Resources/Orthanc/CMake/GoogleTestConfiguration.cmake	Tue Jun 27 15:17:39 2023 +0200
+++ b/Resources/Orthanc/CMake/GoogleTestConfiguration.cmake	Wed Nov 29 10:24:18 2023 +0100
@@ -50,7 +50,7 @@
 
 elseif (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_TEST)
   set(GOOGLE_TEST_SOURCES_DIR ${CMAKE_BINARY_DIR}/googletest-release-1.8.1)
-  set(GOOGLE_TEST_URL "https://orthanc.uclouvain.be/third-party-downloads/gtest-1.8.1.tar.gz")
+  set(GOOGLE_TEST_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/gtest-1.8.1.tar.gz")
   set(GOOGLE_TEST_MD5 "2e6fbeb6a91310a16efe181886c59596")
 
   DownloadPackage(${GOOGLE_TEST_MD5} ${GOOGLE_TEST_URL} "${GOOGLE_TEST_SOURCES_DIR}")
--- a/Resources/Orthanc/Databases/ISqlLookupFormatter.cpp	Tue Jun 27 15:17:39 2023 +0200
+++ b/Resources/Orthanc/Databases/ISqlLookupFormatter.cpp	Wed Nov 29 10:24:18 2023 +0100
@@ -32,15 +32,16 @@
 
 #if ORTHANC_BUILDING_SERVER_LIBRARY == 1
 #  include "../../../OrthancFramework/Sources/OrthancException.h"
+#  include "../../../OrthancFramework/Sources/Toolbox.h"
 #else
 #  include <OrthancException.h>
+#  include <Toolbox.h>
 #endif
 
 #include "DatabaseConstraint.h"
 
 #include <boost/lexical_cast.hpp>
 #include <list>
-#include <Toolbox.h>
 
 
 namespace Orthanc
@@ -303,14 +304,11 @@
     }
   }
 
-  static bool FormatComparisonExperimental(std::string& target,
-                                           ISqlLookupFormatter& formatter,
-                                           const DatabaseConstraint& constraint,
-                                           //size_t index,
-                                           bool escapeBrackets)
+  static bool FormatComparison2(std::string& target,
+                                ISqlLookupFormatter& formatter,
+                                const DatabaseConstraint& constraint,
+                                bool escapeBrackets)
   {
-    //std::string tag = "t" + boost::lexical_cast<std::string>(index);
-
     std::string comparison;
     std::string tagFilter = ("tagGroup = " + boost::lexical_cast<std::string>(constraint.GetTag().GetGroup())
                               + " AND tagElement = " + boost::lexical_cast<std::string>(constraint.GetTag().GetElement()));
@@ -635,7 +633,7 @@
     {
       std::string comparison;
       
-      if (FormatComparisonExperimental(comparison, formatter, lookup[i], escapeBrackets))
+      if (FormatComparison2(comparison, formatter, lookup[i], escapeBrackets))
       {
         if (!comparison.empty())
         {
--- a/Resources/Orthanc/Databases/ISqlLookupFormatter.h	Tue Jun 27 15:17:39 2023 +0200
+++ b/Resources/Orthanc/Databases/ISqlLookupFormatter.h	Wed Nov 29 10:24:18 2023 +0100
@@ -59,7 +59,7 @@
     /**
      * Whether to escape '[' and ']', which is only needed for
      * MSSQL. New in Orthanc 1.10.0, from the following changeset:
-     * https://hg.orthanc-server.com/orthanc-databases/rev/389c037387ea
+     * https://orthanc.uclouvain.be/hg/orthanc-databases/rev/389c037387ea
      **/
     virtual bool IsEscapeBrackets() const = 0;
 
--- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp	Tue Jun 27 15:17:39 2023 +0200
+++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp	Wed Nov 29 10:24:18 2023 +0100
@@ -79,6 +79,10 @@
     }
   }
 
+  void ResetGlobalContext()
+  {
+    globalContext_ = NULL;
+  }
 
   bool HasGlobalContext()
   {
@@ -1670,15 +1674,16 @@
       return true;
     }
 
+#ifdef _MSC_VER
+#define ORTHANC_SCANF sscanf_s
+#else
+#define ORTHANC_SCANF sscanf
+#endif
+
     // Parse the version
-    int aa, bb, cc;
-    if (
-#ifdef _MSC_VER
-      sscanf_s
-#else
-      sscanf
-#endif
-      (version, "%4d.%4d.%4d", &aa, &bb, &cc) != 3 ||
+    int aa, bb, cc = 0;
+    if ((ORTHANC_SCANF(version, "%4d.%4d.%4d", &aa, &bb, &cc) != 3 &&
+         ORTHANC_SCANF(version, "%4d.%4d", &aa, &bb) != 2) ||
       aa < 0 ||
       bb < 0 ||
       cc < 0)
@@ -3752,6 +3757,27 @@
 #endif
 
 
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 1)
+  DicomInstance* DicomInstance::Load(const std::string& instanceId,
+                                     OrthancPluginLoadDicomInstanceMode mode)
+  {
+    OrthancPluginDicomInstance* instance = OrthancPluginLoadDicomInstance(
+      GetGlobalContext(), instanceId.c_str(), mode);
+
+    if (instance == NULL)
+    {
+      ORTHANC_PLUGINS_THROW_EXCEPTION(Plugin);
+    }
+    else
+    {
+      boost::movelib::unique_ptr<DicomInstance> result(new DicomInstance(instance));
+      result->toFree_ = true;
+      return result.release();
+    }
+  }
+#endif
+
+
 #if HAS_ORTHANC_PLUGIN_WEBDAV == 1
   static std::vector<std::string> WebDavConvertPath(uint32_t pathSize,
                                                     const char* const*  pathItems)
--- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h	Tue Jun 27 15:17:39 2023 +0200
+++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h	Wed Nov 29 10:24:18 2023 +0100
@@ -137,6 +137,8 @@
 
   void SetGlobalContext(OrthancPluginContext* context);
 
+  void ResetGlobalContext();
+
   bool HasGlobalContext();
 
   OrthancPluginContext* GetGlobalContext();
@@ -1264,6 +1266,11 @@
 
     ~DicomInstance();
 
+    const OrthancPluginDicomInstance* GetObject() const
+    {
+      return instance_;
+    }
+
     std::string GetRemoteAet() const;
 
     const void* GetBuffer() const
@@ -1318,6 +1325,11 @@
                                     size_t size,
                                     const std::string& transferSyntax);
 #endif
+
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 1)
+    static DicomInstance* Load(const std::string& instanceId,
+                               OrthancPluginLoadDicomInstanceMode mode);
+#endif
   };
 
 // helper method to convert Http headers from the plugin SDK to a std::map
--- a/Resources/SyncOrthancFolder.py	Tue Jun 27 15:17:39 2023 +0200
+++ b/Resources/SyncOrthancFolder.py	Wed Nov 29 10:24:18 2023 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 #
 # This maintenance script updates the content of the "Orthanc" folder
@@ -19,7 +19,7 @@
 PLUGIN_SDK_VERSION_OLD = [ '0.9.5', '1.4.0', '1.5.2', '1.5.4' ]
 PLUGIN_SDK_VERSION_NEW = [ '1.9.2', '1.12.0' ]
 HAS_PROTOCOL_BUFFERS = [ '1.12.0' ]
-REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file'
+REPOSITORY = 'https://orthanc.uclouvain.be/hg/orthanc/raw-file'
 
 FILES = [
     ('default', 'OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'),
--- a/SQLite/CMakeLists.txt	Tue Jun 27 15:17:39 2023 +0200
+++ b/SQLite/CMakeLists.txt	Wed Nov 29 10:24:18 2023 +0100
@@ -97,6 +97,8 @@
   COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1
   )
 
+DefineSourceBasenameForTarget(OrthancSQLiteIndex)
+
 install(
   TARGETS OrthancSQLiteIndex  # OrthancSQLiteStorage  TODO
   RUNTIME DESTINATION lib    # Destination for Windows
@@ -117,3 +119,5 @@
 set_target_properties(UnitTests PROPERTIES
   COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=0
   )
+
+DefineSourceBasenameForTarget(UnitTests)
\ No newline at end of file
--- a/TODO	Tue Jun 27 15:17:39 2023 +0200
+++ b/TODO	Wed Nov 29 10:24:18 2023 +0100
@@ -19,7 +19,7 @@
 
 * Implement the "StoreDicom" option from the default filesystem
   storage area to run MySQL/PostgreSQL storage in index-only mode:
-  https://book.orthanc-server.com/contributing.html
+  https://orthanc.uclouvain.be/book/contributing.html
 
 * Performance: Add a pool of connections to PostgreSQL/MySQL, as
   already done in the database index plugins