public function InsertQuery_sqlite::execute

public InsertQuery_sqlite::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 makes it safe to use in multi-insert loops.

Overrides InsertQuery::execute

File

includes/database/sqlite/query.inc, line 22
Query code for SQLite embedded database engine.

Class

InsertQuery_sqlite
SQLite specific implementation of InsertQuery.

Code

public function execute() {
  if (!$this->preExecute()) {
    return NULL;
  }
  if (count($this->insertFields)) {
    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/includes!database!sqlite!query.inc/function/InsertQuery_sqlite::execute/7.x