# Class yii\db\oci\conditions\LikeConditionBuilder

Inheritance | yii\db\oci\conditions\LikeConditionBuilder » yii\db\conditions\LikeConditionBuilder
Implements | yii\db\ExpressionBuilderInterface
Uses Traits | yii\db\ExpressionBuilderTrait
Source Code | https://github.com/yiisoft/yii2/blob/master/framework/db/oci/conditions/LikeConditionBuilder.php

## Protected Properties

Hide inherited properties

Property | Type | Description | Defined By
--- | --- | --- | ---

## Public Methods

Hide inherited methods

Method | Description | Defined By
--- | --- | ---
__construct() | ExpressionBuilderTrait constructor. | yii\db\ExpressionBuilderTrait
build() | Method builds the raw SQL from the $expression that will not be additionally escaped or quoted. | yii\db\oci\conditions\LikeConditionBuilder

## Protected Methods

Hide inherited methods

Method | Description | Defined By
--- | --- | ---
parseOperator() |  | yii\db\conditions\LikeConditionBuilder

## Property Details

Hide inherited properties

$escapeCharacter protected property

Character used to escape special characters in LIKE conditions. By default it's assumed to be `\`.

protected string|null $escapeCharacter = '!'
$escapingReplacements protected property

{@inheritdoc}

protected $escapingReplacements = [
'%' => '!%',
'_' => '!_',
'!' => '!!',
]

## Method Details

Hide inherited methods

__construct() public method

Defined in: yii\db\ExpressionBuilderTrait::__construct()

ExpressionBuilderTrait constructor.

public void __construct ( yii\db\QueryBuilder $queryBuilder )
$queryBuilder | yii\db\QueryBuilder |

Source code

                    public function __construct(QueryBuilder $queryBuilder)
    {
        $this->queryBuilder = $queryBuilder;
    }

build() public method

Method builds the raw SQL from the $expression that will not be additionally escaped or quoted.

public string build ( yii\db\ExpressionInterface $expression, array &$params = [] )
$expression | yii\db\ExpressionInterface|yii\db\conditions\LikeCondition | The expression to be built.
$params | array | The binding parameters.
return | string | The raw SQL that will not be additionally escaped or quoted.

Source code

                    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);
    }

parseOperator() protected method

Defined in: yii\db\conditions\LikeConditionBuilder::parseOperator()

protected array parseOperator ( $operator )
$operator | string |

Source code

                    protected function parseOperator($operator)
    {
        if (!preg_match('/^(AND |OR |)(((NOT |))I?LIKE)/', $operator, $matches)) {
            throw new InvalidArgumentException("Invalid operator '$operator'.");
        }
        $andor = ' ' . (!empty($matches[1]) ? $matches[1] : 'AND ');
        $not = !empty($matches[3]);
        $operator = $matches[2];
        return [$andor, $not, $operator];
    }