Insert.php in Zircon Profile 8
File
core/lib/Drupal/Core/Database/Driver/sqlite/Insert.php
View source
<?php
namespace Drupal\Core\Database\Driver\sqlite;
use Drupal\Core\Database\Query\Insert as QueryInsert;
class Insert extends QueryInsert {
public function execute() {
if (!$this
->preExecute()) {
return NULL;
}
if (count($this->insertFields) || !empty($this->fromQuery)) {
return parent::execute();
}
else {
return $this->connection
->query('INSERT INTO {' . $this->table . '} DEFAULT VALUES', array(), $this->queryOptions);
}
}
public function __toString() {
$comments = $this->connection
->makeComment($this->comments);
$placeholders = array();
if (!empty($this->insertFields)) {
$placeholders = array_fill(0, count($this->insertFields), '?');
}
if (!empty($this->fromQuery)) {
$insert_fields_string = $this->insertFields ? ' (' . implode(', ', $this->insertFields) . ') ' : ' ';
return $comments . 'INSERT INTO {' . $this->table . '}' . $insert_fields_string . $this->fromQuery;
}
return $comments . 'INSERT INTO {' . $this->table . '} (' . implode(', ', $this->insertFields) . ') VALUES (' . implode(', ', $placeholders) . ')';
}
}