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

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

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


Commits:
b93f08ba by Victor Emanouilov at 2025-09-16T11:53:34+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/b93f08ba195ee3a4c56111cb864eed57293d5330

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/b93f08ba195ee3a4c56111cb864eed57293d5330
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.