diff --git a/dibi/drivers/postgre.php b/dibi/drivers/postgre.php index fb897b3ef..0eab314d6 100644 --- a/dibi/drivers/postgre.php +++ b/dibi/drivers/postgre.php @@ -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 ? "%'" : "'"); }