Insert::execute

public function Insert::execute

public Insert::execute()

Executes the insert query.

Return value

The last insert ID of the query, if one exists. If the query was given multiple sets of values to insert, the return value is undefined. If no fields are specified, this method will do nothing and return NULL. That That makes it safe to use in multi-insert loops.

Overrides Insert::execute

File

core/lib/Drupal/Core/Database/Driver/sqlite/Insert.php, line 16

Class

Insert
SQLite implementation of \Drupal\Core\Database\Query\Insert.

Namespace

Drupal\Core\Database\Driver\sqlite

Code

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);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Driver!sqlite!Insert.php/function/Insert::execute/8.1.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部