You are here

public function Connection::queryRange in Zircon Profile 8

Same name in this branch
  1. 8 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::queryRange()
  2. 8 core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php \Drupal\Core\Database\Driver\sqlite\Connection::queryRange()
  3. 8 core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php \Drupal\Core\Database\Driver\pgsql\Connection::queryRange()
  4. 8 core/lib/Drupal/Core/Database/Driver/mysql/Connection.php \Drupal\Core\Database\Driver\mysql\Connection::queryRange()
Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Database/Driver/mysql/Connection.php \Drupal\Core\Database\Driver\mysql\Connection::queryRange()

Runs a limited-range query on this database object.

Use this as a substitute for ->query() when a subset of the query is to be returned. User-supplied arguments to the query should be passed in as separate parameters so that they can be properly escaped to avoid SQL injection attacks.

Parameters

string $query: A string containing an SQL query.

int $from: The first result row to return.

int $count: The maximum number of result rows to return.

array $args: (optional) An array of values to substitute into the query at placeholder markers.

array $options: (optional) An array of options on the query.

Return value

\Drupal\Core\Database\StatementInterface A database query result resource, or NULL if the query was not executed correctly.

Overrides Connection::queryRange

File

core/lib/Drupal/Core/Database/Driver/mysql/Connection.php, line 202
Contains \Drupal\Core\Database\Driver\mysql\Connection.

Class

Connection
MySQL implementation of \Drupal\Core\Database\Connection.

Namespace

Drupal\Core\Database\Driver\mysql

Code

public function queryRange($query, $from, $count, array $args = array(), array $options = array()) {
  return $this
    ->query($query . ' LIMIT ' . (int) $from . ', ' . (int) $count, $args, $options);
}