routeSQL : search can now start with a ^ or finished by a dollar to simulate a regex
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2019 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
13
routeSQL.php
13
routeSQL.php
@@ -306,7 +306,18 @@ class routeSQL
|
|||||||
{
|
{
|
||||||
$criteria = array ();
|
$criteria = array ();
|
||||||
foreach (array_keys($titles) as $column)
|
foreach (array_keys($titles) as $column)
|
||||||
$criteria[] = array ($column, "%$search%", "LIKE");
|
{
|
||||||
|
$s = $search;
|
||||||
|
if ($search[0] === "^")
|
||||||
|
$s = substr ($s, 1);
|
||||||
|
else
|
||||||
|
$s = "%$s";
|
||||||
|
if (substr ($search, -1) === "$")
|
||||||
|
$s = substr ($s, 0, -1);
|
||||||
|
else
|
||||||
|
$s = "$s%";
|
||||||
|
$criteria[] = array ($column, "$s", "LIKE");
|
||||||
|
}
|
||||||
$datas = $this->objectDB->read ($criteria, null, null, true);
|
$datas = $this->objectDB->read ($criteria, null, null, true);
|
||||||
}
|
}
|
||||||
$nbentries = count ($datas);
|
$nbentries = count ($datas);
|
||||||
|
|||||||
Reference in New Issue
Block a user