Commit f46c7060 by Fourteenmeister

Update QueryBuilder.php

fix error occurs when you use multiple databases.
parent b36b9bfd
......@@ -214,11 +214,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment