Skip to content

Commit

Permalink
MSSQL: select what is really needed from information_schema.columns, …
Browse files Browse the repository at this point in the history
…not just everything as it was before.
  • Loading branch information
resurtm committed May 23, 2013
1 parent 8e1079c commit d67416a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/yii/db/mssql/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ protected function loadColumnSchema($info)
$column->isPrimaryKey = null; // primary key will be determined in findColumns() method
$column->autoIncrement = $info['IsIdentity'] == 1;
$column->unsigned = stripos($column->dbType, 'unsigned') !== false;
$column->comment = $info['Comment'] === null ? '' : $column['Comment'];
$column->comment = $info['Comment'] === null ? '' : $info['Comment'];

$column->type = self::TYPE_STRING;
if (preg_match('/^(\w+)(?:\(([^\)]+)\))?/', $column->dbType, $matches)) {
Expand Down Expand Up @@ -221,7 +221,7 @@ protected function findColumns($table)

$sql = <<<SQL
SELECT
[t1].*,
[t1].[COLUMN_NAME], [t1].[IS_NULLABLE], [t1].[DATA_TYPE], [t1].[COLUMN_DEFAULT],
COLUMNPROPERTY(OBJECT_ID([t1].[table_schema] + '.' + [t1].[table_name]), [t1].[column_name], 'IsIdentity') AS IsIdentity,
CONVERT(VARCHAR, [t2].[value]) AS Comment
FROM {$columnsTableName} AS [t1]
Expand Down

0 comments on commit d67416a

Please sign in to comment.