Skip to content
Permalink
Browse files

Fix up SQLite INSERT query generation

The UNION ALL transformation had to be updated so it reflected the root
query type using named placeholders instead of nameless ones.
  • Loading branch information...
markstory committed Sep 22, 2014
1 parent b7ae2a5 commit 6946058629aa9cacbd7b362a5cad4bca55b548a8
Showing with 9 additions and 3 deletions.
  1. +9 −3 src/Database/Dialect/SqliteDialectTrait.php
@@ -116,15 +116,21 @@ protected function _insertQueryTranslator($query) {
$newQuery = $query->connection()->newQuery();
$cols = $v->columns();
$placeholder = 0;
$replaceQuery = false;
foreach ($v->values() as $k => $val) {
$fillLength = count($cols) - count($val);
if ($fillLength > 0) {
$val = array_merge($val, array_fill(0, $fillLength, null));
}
$val = array_map(function ($val) {
return $val instanceof ExpressionInterface ? $val : '?';
}, $val);
foreach ($val as $col => $attr) {
if (!($attr instanceof ExpressionInterface)) {
$val[$col] = sprintf(':c%d', $placeholder);
$placeholder++;
}
}
$select = array_combine($cols, $val);
if ($k === 0) {

0 comments on commit 6946058

Please sign in to comment.
You can’t perform that action at this time.