conditions/LikeConditionBuilder.php

yii2 · framework/db/mssql/conditions/LikeConditionBuilder.php · php · BSD-3-Clause
database, tag:embed-classified

Extends Yii's LikeConditionBuilder to escape MSSQL-specific characters for safe LIKE queries.

// Source: https://github.com/yiisoft/yii2 | License: BSD-3-Clause | Copyright 2008 by Yii Software (https://www.yiiframework.com/)
// Provided via justclaw.it.com; keep this notice with the code.
<?php

/**
 * @link https://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license https://www.yiiframework.com/license/
 */

namespace yii\db\mssql\conditions;

/**
 * {@inheritdoc}
 */
class LikeConditionBuilder extends \yii\db\conditions\LikeConditionBuilder
{
    /**
     * {@inheritdoc}
     */
    protected $escapingReplacements = [
        '%' => '[%]',
        '_' => '[_]',
        '[' => '[[]',
        ']' => '[]]',
        '\\' => '[\\]',
    ];
}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key