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 ...@@ -214,11 +214,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
if (!$table) { if (!$table) {
return null; return null;
} }
$columns = (new \yii\db\Query()) $columns = $this->db->createCommand("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='{$table}'")->queryColumn();
->select('name')
->from('sys.columns')
->where("object_id = OBJECT_ID('dbo.{$table}')")
->column();
array_walk($columns, create_function('&$str', '$str = "[$str]";')); array_walk($columns, create_function('&$str', '$str = "[$str]";'));
return $columns; 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