mirror of
https://github.com/dg/dibi.git
synced 2025-08-06 14:16:39 +02:00
implemented escapeLike() and modifiers %~like, %like~, %~like~
This commit is contained in:
@@ -230,6 +230,20 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriv
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encodes string for use in a LIKE statement.
|
||||
* @param string
|
||||
* @param int
|
||||
* @return string
|
||||
*/
|
||||
public function escapeLike($value, $pos)
|
||||
{
|
||||
$value = strtr($value, array("'" => "''", '%' => '[%]', '_' => '[_]', '[' => '[[]'));
|
||||
return ($pos <= 0 ? "'%" : "'") . $value . ($pos >= 0 ? "%'" : "'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Decodes data from result set.
|
||||
* @param string value
|
||||
|
Reference in New Issue
Block a user