Yii2 framework backup
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB

<?php
namespace yii\db\oci\conditions;
use yii\db\ExpressionInterface;
/**
* {@inheritdoc}
*/
class LikeConditionBuilder extends \yii\db\conditions\LikeConditionBuilder
{
/**
* {@inheritdoc}
*/
protected $escapeCharacter = '!';
/**
* `\` is initialized in [[buildLikeCondition()]] method since
* we need to choose replacement value based on [[\yii\db\Schema::quoteValue()]].
* {@inheritdoc}
*/
protected $escapingReplacements = [
'%' => '!%',
'_' => '!_',
'!' => '!!',
];
/**
* {@inheritdoc}
*/
public function build(ExpressionInterface $expression, array &$params = [])
{
if (!isset($this->escapingReplacements['\\'])) {
/*
* Different pdo_oci8 versions may or may not implement PDO::quote(), so
* yii\db\Schema::quoteValue() may or may not quote \.
*/
$this->escapingReplacements['\\'] = substr($this->queryBuilder->db->quoteValue('\\'), 1, -1);
}
return parent::build($expression, $params);
}
}