fix(model): Fix postgresql search.
This commit is contained in:
@@ -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 |
|
||||
|------------------+---------------+---------+------------|
|
||||
|
||||
@@ -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 || '%'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user