"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "framework/db/mssql/Schema.php" between
yii2-2.0.35.tar.gz and yii2-2.0.36.tar.gz

About: Yii 2 is a high-performance component-based PHP framework for developing large-scale Web applications (source).

Schema.php  (yii2-2.0.35):Schema.php  (yii2-2.0.36)
skipping to change at line 597 skipping to change at line 597
$schema = $this->defaultSchema; $schema = $this->defaultSchema;
} }
$sql = <<<'SQL' $sql = <<<'SQL'
SELECT [t].[table_name] SELECT [t].[table_name]
FROM [INFORMATION_SCHEMA].[TABLES] AS [t] FROM [INFORMATION_SCHEMA].[TABLES] AS [t]
WHERE [t].[table_schema] = :schema AND [t].[table_type] = 'VIEW' WHERE [t].[table_schema] = :schema AND [t].[table_type] = 'VIEW'
ORDER BY [t].[table_name] ORDER BY [t].[table_name]
SQL; SQL;
return $this->db->createCommand($sql, [':schema' => $schema])->queryColu $views = $this->db->createCommand($sql, [':schema' => $schema])->queryCo
mn(); lumn();
$views = array_map(static function ($item) {
return '[' . $item . ']';
}, $views);
return $views;
} }
/** /**
* Returns all unique indexes for the given table. * Returns all unique indexes for the given table.
* *
* Each array element is of the following structure: * Each array element is of the following structure:
* *
* ```php * ```php
* [ * [
* 'IndexName1' => ['col1' [, ...]], * 'IndexName1' => ['col1' [, ...]],
skipping to change at line 753 skipping to change at line 758
* {@inheritdoc} * {@inheritdoc}
*/ */
public function quoteColumnName($name) public function quoteColumnName($name)
{ {
if (preg_match('/^\[.*\]$/', $name)) { if (preg_match('/^\[.*\]$/', $name)) {
return $name; return $name;
} }
return parent::quoteColumnName($name); return parent::quoteColumnName($name);
} }
/**
* Retrieving inserted data from a primary key request of type uniqueidentif
ier (for SQL Server 2005 or later)
* {@inheritdoc}
*/
public function insert($table, $columns)
{
$command = $this->db->createCommand()->insert($table, $columns);
if (!$command->execute()) {
return false;
}
$isVersion2005orLater = version_compare($this->db->getSchema()->getServe
rVersion(), '9', '>=');
$inserted = $isVersion2005orLater ? $command->pdoStatement->fetch() : []
;
$tableSchema = $this->getTableSchema($table);
$result = [];
foreach ($tableSchema->primaryKey as $name) {
if ($tableSchema->columns[$name]->autoIncrement) {
$result[$name] = $this->getLastInsertID($tableSchema->sequenceNa
me);
break;
}
// @see https://github.com/yiisoft/yii2/issues/13828 & https://githu
b.com/yiisoft/yii2/issues/17474
if (isset($inserted[$name])) {
$result[$name] = $inserted[$name];
} elseif (isset($columns[$name])) {
$result[$name] = $columns[$name];
} else {
$result[$name] = $tableSchema->columns[$name]->defaultValue;
}
}
return $result;
}
} }
 End of changes. 2 change blocks. 
2 lines changed or deleted 46 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)