mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-16 15:21:13 +08:00
Fixes #3752: QueryBuilder::batchInsert()
does not typecast input values
This commit is contained in:
@ -40,6 +40,7 @@ Yii Framework 2 Change Log
|
|||||||
- Bug #3601: Fixed the bug that the refresh URL was not generated correctly by `Captcha` (qiangxue, klevron)
|
- Bug #3601: Fixed the bug that the refresh URL was not generated correctly by `Captcha` (qiangxue, klevron)
|
||||||
- Bug #3715: Fixed the bug that using a custom pager/sorter with `GridView` may generate two different pagers/sorters if the layout configures two pagers/sorters (qiangxue)
|
- Bug #3715: Fixed the bug that using a custom pager/sorter with `GridView` may generate two different pagers/sorters if the layout configures two pagers/sorters (qiangxue)
|
||||||
- Bug #3716: `DynamicModel::validateData()` does not call `validate()` if the `$rules` parameter is empty (qiangxue)
|
- Bug #3716: `DynamicModel::validateData()` does not call `validate()` if the `$rules` parameter is empty (qiangxue)
|
||||||
|
- Bug #3752: `QueryBuilder::batchInsert()` does not typecast input values (qiangxue)
|
||||||
- Bug: Fixed inconsistent return of `\yii\console\Application::runAction()` (samdark)
|
- Bug: Fixed inconsistent return of `\yii\console\Application::runAction()` (samdark)
|
||||||
- Bug: URL encoding for the route parameter added to `\yii\web\UrlManager` (klimov-paul)
|
- Bug: URL encoding for the route parameter added to `\yii\web\UrlManager` (klimov-paul)
|
||||||
- Bug: Fixed the bug that requesting protected or private action methods would cause 500 error instead of 404 (qiangxue)
|
- Bug: Fixed the bug that requesting protected or private action methods would cause 500 error instead of 404 (qiangxue)
|
||||||
|
@ -183,10 +183,6 @@ class QueryBuilder extends \yii\base\Object
|
|||||||
$columnSchemas = [];
|
$columnSchemas = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($columns as $i => $name) {
|
|
||||||
$columns[$i] = $this->db->quoteColumnName($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
$values = [];
|
$values = [];
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$vs = [];
|
$vs = [];
|
||||||
@ -206,6 +202,10 @@ class QueryBuilder extends \yii\base\Object
|
|||||||
$values[] = '(' . implode(', ', $vs) . ')';
|
$values[] = '(' . implode(', ', $vs) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($columns as $i => $name) {
|
||||||
|
$columns[$i] = $this->db->quoteColumnName($name);
|
||||||
|
}
|
||||||
|
|
||||||
return 'INSERT INTO ' . $this->db->quoteTableName($table)
|
return 'INSERT INTO ' . $this->db->quoteTableName($table)
|
||||||
. ' (' . implode(', ', $columns) . ') VALUES ' . implode(', ', $values);
|
. ' (' . implode(', ', $columns) . ') VALUES ' . implode(', ', $values);
|
||||||
}
|
}
|
||||||
|
@ -68,10 +68,6 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
|||||||
$columnSchemas = [];
|
$columnSchemas = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($columns as $i => $name) {
|
|
||||||
$columns[$i] = $this->db->quoteColumnName($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
$values = [];
|
$values = [];
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$vs = [];
|
$vs = [];
|
||||||
@ -91,6 +87,10 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
|||||||
$values[] = implode(', ', $vs);
|
$values[] = implode(', ', $vs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($columns as $i => $name) {
|
||||||
|
$columns[$i] = $this->db->quoteColumnName($name);
|
||||||
|
}
|
||||||
|
|
||||||
return 'INSERT INTO ' . $this->db->quoteTableName($table)
|
return 'INSERT INTO ' . $this->db->quoteTableName($table)
|
||||||
. ' (' . implode(', ', $columns) . ') SELECT ' . implode(' UNION SELECT ', $values);
|
. ' (' . implode(', ', $columns) . ') SELECT ' . implode(' UNION SELECT ', $values);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user