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:
2015-03-12 20:10:16 +00:00
parent c1f009107f
commit 9aa5c8dcc7

View File

@@ -306,7 +306,18 @@ class routeSQL
{
$criteria = array ();
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);
}
$nbentries = count ($datas);