init
This commit is contained in:
58
vendor/yiisoft/yii2/db/mssql/conditions/InConditionBuilder.php
vendored
Normal file
58
vendor/yiisoft/yii2/db/mssql/conditions/InConditionBuilder.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
*/
|
||||
|
||||
namespace yii\db\mssql\conditions;
|
||||
|
||||
use yii\base\NotSupportedException;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @author Dmytro Naumenko <d.naumenko.a@gmail.com>
|
||||
* @since 2.0.14
|
||||
*/
|
||||
class InConditionBuilder extends \yii\db\conditions\InConditionBuilder
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @throws NotSupportedException if `$columns` is an array
|
||||
*/
|
||||
protected function buildSubqueryInCondition($operator, $columns, $values, &$params)
|
||||
{
|
||||
if (is_array($columns)) {
|
||||
throw new NotSupportedException(__METHOD__ . ' is not supported by MSSQL.');
|
||||
}
|
||||
|
||||
return parent::buildSubqueryInCondition($operator, $columns, $values, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function buildCompositeInCondition($operator, $columns, $values, &$params)
|
||||
{
|
||||
$quotedColumns = [];
|
||||
foreach ($columns as $i => $column) {
|
||||
$quotedColumns[$i] = strpos($column, '(') === false ? $this->queryBuilder->db->quoteColumnName($column) : $column;
|
||||
}
|
||||
$vss = [];
|
||||
foreach ($values as $value) {
|
||||
$vs = [];
|
||||
foreach ($columns as $i => $column) {
|
||||
if (isset($value[$column])) {
|
||||
$phName = $this->queryBuilder->bindParam($value[$column], $params);
|
||||
$vs[] = $quotedColumns[$i] . ($operator === 'IN' ? ' = ' : ' != ') . $phName;
|
||||
} else {
|
||||
$vs[] = $quotedColumns[$i] . ($operator === 'IN' ? ' IS' : ' IS NOT') . ' NULL';
|
||||
}
|
||||
}
|
||||
$vss[] = '(' . implode($operator === 'IN' ? ' AND ' : ' OR ', $vs) . ')';
|
||||
}
|
||||
|
||||
return '(' . implode($operator === 'IN' ? ' OR ' : ' AND ', $vss) . ')';
|
||||
}
|
||||
}
|
||||
25
vendor/yiisoft/yii2/db/mssql/conditions/LikeConditionBuilder.php
vendored
Normal file
25
vendor/yiisoft/yii2/db/mssql/conditions/LikeConditionBuilder.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
*/
|
||||
|
||||
namespace yii\db\mssql\conditions;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
class LikeConditionBuilder extends \yii\db\conditions\LikeConditionBuilder
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $escapingReplacements = [
|
||||
'%' => '[%]',
|
||||
'_' => '[_]',
|
||||
'[' => '[[]',
|
||||
']' => '[]]',
|
||||
'\\' => '[\\]',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user