Skip to content

Commit

Permalink
implemented escapeLike() for PostgreSQL driver
Browse files Browse the repository at this point in the history
  • Loading branch information
milo committed Mar 10, 2011
1 parent 8a899c7 commit b979295
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion dibi/drivers/postgre.php
Expand Up @@ -319,7 +319,14 @@ public function escape($value, $type)
*/
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 ? "%'" : "'");
}


Expand Down

0 comments on commit b979295

Please sign in to comment.