From ce03bdb27d183622ad1bd6d5ce441a7efacb4e92 Mon Sep 17 00:00:00 2001 From: kj Date: Mon, 27 Oct 2025 15:16:54 -0300 Subject: [PATCH] fix(model): Fix postgresql search. --- readme.org | 2 +- src/Libs/Model.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/readme.org b/readme.org index d40e2fa..be40f36 100644 --- a/readme.org +++ b/readme.org @@ -103,7 +103,7 @@ En la siguiente tabla se encuentra la lista de estados de los gestores de bases |------------------+---------------+---------+------------| | getById | ok | ok | ok | |------------------+---------------+---------+------------| -| search | ok | ok | error | +| search | ok | ok | ok | |------------------+---------------+---------+------------| | get | ok | ok | ok | |------------------+---------------+---------+------------| diff --git a/src/Libs/Model.php b/src/Libs/Model.php index bb43e80..5b3ceb1 100644 --- a/src/Libs/Model.php +++ b/src/Libs/Model.php @@ -1040,13 +1040,13 @@ class Model $search = static::bind($search); $where = []; - if (static::db()->getAttribute(PDO::ATTR_DRIVER_NAME) == 'sqlite') { + if (static::db()->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { foreach ($in as $row) { - $where[] = "$row LIKE '%' || $search || '%'"; + $where[] = "$row LIKE CONCAT('%', $search, '%')"; } } else { foreach ($in as $row) { - $where[] = "$row LIKE CONCAT('%', $search, '%')"; + $where[] = "CAST($row AS TEXT) LIKE '%' || $search || '%'"; } }