Skip to content

Commit

Permalink
Fix ODBC Driver 13 for SQL Server error on null (yiisoft#16039)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsivsivsi authored and SilverFire committed Apr 29, 2018
1 parent f5665a0 commit cb15a41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion framework/db/mssql/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ private function normalizeTableRowData($table, $columns, &$params)
$columnSchemas = $tableSchema->columns;
foreach ($columns as $name => $value) {
// @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)) {
if (isset($columnSchemas[$name]) && $columnSchemas[$name]->type === Schema::TYPE_BINARY && $columnSchemas[$name]->dbType === 'varbinary' && (is_string($value) || $value === null)) {
$exParams = [];
$phName = $this->bindParam($value, $exParams);
$columns[$name] = new Expression("CONVERT(VARBINARY, $phName)", $exParams);
Expand Down

0 comments on commit cb15a41

Please sign in to comment.