Fix #17635: Fix varbinary data handling for MSSQL

This commit is contained in:
Oleg
2020-01-16 21:19:34 +05:00
committed by Alexander Makarov
parent 5f4a8cb2be
commit 559206bc78
3 changed files with 15 additions and 1 deletions

View File

@ -426,7 +426,8 @@ class QueryBuilder extends \yii\db\QueryBuilder
// @see https://github.com/yiisoft/yii2/issues/12599
if (isset($columnSchemas[$name]) && $columnSchemas[$name]->type === Schema::TYPE_BINARY && $columnSchemas[$name]->dbType === 'varbinary' && (is_string($value) || $value === null)) {
$phName = $this->bindParam($value, $params);
$columns[$name] = new Expression("CONVERT(VARBINARY, $phName)", $params);
// @see https://github.com/yiisoft/yii2/issues/12599
$columns[$name] = new Expression("CONVERT(VARBINARY(MAX), $phName)", $params);
}
}
}