changeset 353:389c037387ea

Escaping '[' & ']' (change necessary only for MSSQL but this does not impact PG and MySQL plugins that were already matching angle brackets correctly)
author Alain Mazy <am@osimis.io>
date Mon, 15 Nov 2021 12:22:44 +0100
parents 5afa19dc8562
children 2a3bbb4104fa
files .hgignore Odbc/NEWS Resources/Orthanc/Databases/ISqlLookupFormatter.cpp
diffstat 3 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Thu Aug 12 13:27:41 2021 +0200
+++ b/.hgignore	Mon Nov 15 12:22:44 2021 +0100
@@ -1,4 +1,7 @@
 build*
 PostgreSQL/CMakeLists.txt.user
 PostgreSQL/ThirdPartyDownloads/
+Odbc/ThirdPartyDownloads/
+MySQL/ThirdPartyDownloads/
+.vscode/
 
--- a/Odbc/NEWS	Thu Aug 12 13:27:41 2021 +0200
+++ b/Odbc/NEWS	Mon Nov 15 12:22:44 2021 +0100
@@ -1,6 +1,9 @@
 Pending changes in the mainline
 ===============================
 
+* Now escaping '[' & ']' characters in lookup queries to allow matching e.g
+  PatientName containing angle brackets
+
 
 Release 1.0 (2021-08-12)
 ========================
--- a/Resources/Orthanc/Databases/ISqlLookupFormatter.cpp	Thu Aug 12 13:27:41 2021 +0200
+++ b/Resources/Orthanc/Databases/ISqlLookupFormatter.cpp	Mon Nov 15 12:22:44 2021 +0100
@@ -172,6 +172,14 @@
             {
               escaped += "_";
             }
+            else if (value[i] == '[')
+            {
+              escaped += "\\[";
+            }
+            else if (value[i] == ']')
+            {
+              escaped += "\\]";
+            }
             else if (value[i] == '%')
             {
               escaped += "\\%";