[TikiWiki-commits] [Git][tikiwiki/tiki][28.x] [FIX] odbc manager: fix sql query syntax

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68c9258858449_2c41f0dc09722f@gitlab-sidekiq-low-urgency-cpu-bound-v2-7d77d7489b-mjqww.mail>

Victor Emanouilov pushed to branch 28.x at Tiki Wiki CMS Groupware / Tiki


Commits:
3d454fdd by Victor Emanouilov at 2025-09-16T11:53:22+03:00
[FIX] odbc manager: fix sql query syntax

- - - - -


1 changed file:

- lib/core/Tracker/Tabular/ODBCManager.php


Changes:

=====================================
lib/core/Tracker/Tabular/ODBCManager.php
=====================================
@@ -44,14 +44,16 @@ class ODBCManager
             $result = odbc_fetch_array($rs);
         } else {
             $sql = "SELECT * FROM {$this->config['table']} WHERE " . implode(' AND ', array_map(function ($k, $v) {
-                return empty($v) ? "\"{$k} IS NULL\"" : "\"{$k}\" = ?";
+                return empty($v) ? "\"{$k}\" IS NULL" : "\"{$k}\" = ?";
             }, array_keys($row), $row));
             $rs = odbc_prepare($conn, $sql);
             $params = array_filter(array_values($row));
             odbc_execute($rs, $params);
             $result = odbc_fetch_array($rs);
         }
-        $result = $this->reverseMapFieldsFromConfig($result);
+        if ($result) {
+            $result = $this->reverseMapFieldsFromConfig($result);
+        }
         $this->stopErrorHandler();
         return $result;
     }
@@ -240,7 +242,7 @@ class ODBCManager
             $sql = "UPDATE {$this->config['table']} SET " . implode(', ', array_map(function ($k) {
                 return "\"{$k}\" = ?";
             }, array_keys($chunk))) . " WHERE " . implode(' AND ', array_map(function ($k, $v) {
-                return empty($v) ? "\"{$k} IS NULL\"" : "\"{$k}\" = ?";
+                return empty($v) ? "\"{$k}\" IS NULL" : "\"{$k}\" = ?";
             }, array_keys($existing), $existing));
             $rs = odbc_prepare($conn, $sql);
             $params = array_map(function ($v) {
@@ -256,7 +258,7 @@ class ODBCManager
             $existing[$k] = $v;
         }
         $sql = "SELECT * FROM {$this->config['table']} WHERE " . implode(' AND ', array_map(function ($k, $v) {
-            return empty($v) ? "\"{$k} IS NULL\"" : "\"{$k}\" = ?";
+            return empty($v) ? "\"{$k}\" IS NULL" : "\"{$k}\" = ?";
         }, array_keys($existing), $existing));
         $rs = odbc_prepare($conn, $sql);
         $params = array_filter(array_values($existing));



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/3d454fddd7264ef4f4b5409d4750c694888e0d7d

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/3d454fddd7264ef4f4b5409d4750c694888e0d7d
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.