[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][FIX] ODBC: fix sql server max value get query
"Baraka Kinywa \(@bkinywa24\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <68b8156c4e47c_2cdcf8c38091@gitlab-sidekiq-low-urgency-cpu-bound-v2-dc78c9688-d8jsw.mail> |
Baraka Kinywa pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki
Commits:
fed34641 by MAGENE Sem Joel at 2025-09-03T13:08:29+03:00
[BP][FIX] ODBC: fix sql server max value get query
---
* [FIX] ODBC: fix sql server max value get query
(cherry picked from commit 48492a5d1dbb7dc1cd7b79fed3d1fc447bc8b213)
See merge request tikiwiki/tiki!8487
- - - - -
1 changed file:
- lib/core/Tracker/Tabular/ODBCManager.php
Changes:
=====================================
lib/core/Tracker/Tabular/ODBCManager.php
=====================================
@@ -301,7 +301,11 @@ class ODBCManager
{
$this->handleErrors();
$conn = $this->getConnection();
- $sql = "SELECT MAX(CAST(\"$field\" AS DECIMAL(20,0))) as last from {$this->config['table']} WHERE \"$field\" REGEXP '^[0-9]+$'";
+ if (stristr($this->config['dsn'], 'mysql') || stristr($this->config['dsn'], 'mariadb')) {
+ $sql = "SELECT MAX(CAST(\"$field\" AS SIGNED)) as last from {$this->config['table']} WHERE \"$field\" REGEXP '^[0-9]+$'";
+ } else {
+ $sql = "SELECT MAX(CAST(\"$field\" AS INT)) as last from {$this->config['table']} WHERE ISNUMERIC(\"$field\") = 1";
+ }
$rs = odbc_prepare($conn, $sql);
if ($rs) {
odbc_execute($rs, []);
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/fed3464168f45316c163c7c68166e6a948c18ad7
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/fed3464168f45316c163c7c68166e6a948c18ad7
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