Class yii\db\oci\conditions\LikeConditionBuilder
Protected Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $escapeCharacter | string|null | Character used to escape special characters in LIKE conditions. | yii\ |
| $escapingReplacements | \ is initialized in buildLikeCondition() method since
we need to choose replacement value based on yii\ |
yii\ |
|
| $queryBuilder | yii\ |
yii\ |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | ExpressionBuilderTrait constructor. | yii\ |
| build() | Method builds the raw SQL from the $expression that will not be additionally escaped or quoted. | yii\ |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| parseOperator() | yii\ |
Property Details
Character used to escape special characters in LIKE conditions.
By default it's assumed to be \.
{@inheritdoc}
Method Details
Defined in:
yii\
ExpressionBuilderTrait constructor.
| public mixed __construct ( yii\ | ||
| $queryBuilder | yii\ |
|
public function __construct(QueryBuilder $queryBuilder)
{
$this->queryBuilder = $queryBuilder;
}
Method builds the raw SQL from the $expression that will not be additionally escaped or quoted.
| public string build ( yii\ | ||
| $expression | yii\ |
The expression to be built. |
| $params | array |
The binding parameters. |
| return | string |
The raw SQL that will not be additionally escaped or quoted. |
|---|---|---|
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);
}
| protected array parseOperator ( string $operator ) | ||
| $operator | string | |
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];
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.