1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-24 02:43:09 +01:00

Merge pull request #34 from mil0/master.

implemented escapeLike() for PostgreSQL driver
This commit is contained in:
David Grudl 2011-05-02 15:35:20 -07:00
commit 508e8638e8

View File

@ -319,7 +319,14 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver, IDibiResultDr
*/
public function escapeLike($value, $pos)
{
throw new NotImplementedException;
if ($this->escMethod) {
$value = pg_escape_string($this->connection, $value);
} else {
$value = pg_escape_string($value);
}
$value = strtr($value, array( '%' => '\\\\%', '_' => '\\\\_'));
return ($pos <= 0 ? "'%" : "'") . $value . ($pos >= 0 ? "%'" : "'");
}