1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-05 21:58:10 +02:00

implemented escapeLike() for PostgreSQL driver

This commit is contained in:
Miloslav Hůla
2011-03-10 14:33:34 +01:00
parent 8a899c7ddb
commit b979295baa

View File

@@ -319,7 +319,14 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver, IDibiResultDr
*/ */
public function escapeLike($value, $pos) 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 ? "%'" : "'");
} }