Commit b04e23f8 by Carsten Brandt

use native suppport for batch insert in SQLite >= 3.7.11

fixes #3559
parent 7b13c370
......@@ -36,6 +36,7 @@ Yii Framework 2 Change Log
- Bug #3478: Fixed yii\console\Controller::select accept empty input as '0' value (lynicidn)
- Bug #3522: Fixed BaseFileHelper::normalizePath to allow a (.) for the current path. (skotos)
- Bug #3548: Fixed the bug that X-Rate-Limit-Remaining header is always zero when using RateLimiter (qiangxue)
- Bug #3559: Use native support for batchInsert in SQLite versions >= 3.7.11 and avoid limitations of the fallback (cebe)
- Bug #3564: Fixed the bug that primary key columns should not take default values from schema (qiangxue)
- Bug #3567: Fixed the bug that smallint was treated as string for PostgreSQL (qiangxue)
- Bug #3578: Fixed postgreSQL column type detection, added missing types (MDMunir, cebe)
......
......@@ -41,6 +41,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
Schema::TYPE_MONEY => 'decimal(19,4)',
];
/**
* Generates a batch INSERT SQL statement.
* For example,
......@@ -62,6 +63,12 @@ class QueryBuilder extends \yii\db\QueryBuilder
*/
public function batchInsert($table, $columns, $rows)
{
// SQLite supports batch insert natively since 3.7.11
// http://www.sqlite.org/releaselog/3_7_11.html
if (version_compare(\SQLite3::version()['versionString'], '3.7.11', '>=')) {
return parent::batchInsert($table, $columns, $rows);
}
if (($tableSchema = $this->db->getTableSchema($table)) !== null) {
$columnSchemas = $tableSchema->columns;
} else {
......
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