function Statement::executeAndPrefetch

Executes the statement and prefetches the result.

Parameters

array $args: An array of values with as many elements as there are bound parameters in the SQL statement being executed.

Return value

bool TRUE on success, or FALSE on failure.

1 call to Statement::executeAndPrefetch()
Statement::execute in core/modules/sqlite/src/Driver/Database/sqlite/Statement.php
Executes a prepared statement.

File

core/modules/sqlite/src/Driver/Database/sqlite/Statement.php, line 163

Class

Statement
SQLite implementation of \Drupal\Core\Database\StatementInterface.

Namespace

Drupal\sqlite\Driver\Database\sqlite

Code

protected function executeAndPrefetch(array $args) : bool {
  $startEvent = $this->dispatchStatementExecutionStartEvent($args);
  // Prepare and execute the statement.
  try {
    $this->clientStatement = $this->getStatement($this->queryString, $args);
    $return = $this->clientExecute($args);
  } catch (\Exception $e) {
    // In case of failure, cleanup and exit early - without preprocessing the
    // exception.
    $this->dispatchStatementExecutionFailureEvent($startEvent, $e);
    $this->clientStatement = NULL;
    throw $e;
  }
  // Fetch all the data from the reply, in order to release any lock as soon
  // as possible. Then, destroy the client statement.
  $this->result = new PrefetchedResult($this->fetchMode, $this->fetchOptions, $this->clientFetchAll(FetchAs::Associative), $this->rowCountEnabled ? $this->clientRowCount() : NULL);
  $this->clientStatement = NULL;
  $this->markResultsetIterable($return);
  $this->dispatchStatementExecutionEndEvent($startEvent);
  return $return;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.