Skip to content

Commit

Permalink
Update QueryBuilder.php
Browse files Browse the repository at this point in the history
fix error occurs when you use multiple databases.
  • Loading branch information
fourteenmeister committed May 14, 2014
1 parent b36b9bf commit f46c706
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions framework/db/mssql/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,7 @@ protected function getAllColumnNames($table = null)
if (!$table) {
return null;
}
$columns = (new \yii\db\Query())
->select('name')
->from('sys.columns')
->where("object_id = OBJECT_ID('dbo.{$table}')")
->column();
$columns = $this->db->createCommand("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='{$table}'")->queryColumn();
array_walk($columns, create_function('&$str', '$str = "[$str]";'));
return $columns;
}
Expand Down

0 comments on commit f46c706

Please sign in to comment.