function Connection::query

Same name in this branch
  1. 8.9.x core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php \Drupal\Core\Database\Driver\pgsql\Connection::query()
  2. 8.9.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::query()
Same name in other branches
  1. 9 core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::query()
  2. 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::query()
  3. 10 core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::query()
  4. 10 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::query()
  5. 11.x core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::query()
  6. 11.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::query()

Overrides Connection::query

5 calls to Connection::query()
Connection::nextId in core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
Retrieves an unique ID from a given sequence.
Connection::nextIdDelete in core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
Connection::popCommittableTransactions in core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
Overridden to work around issues to MySQL not supporting transactional DDL.
Connection::queryRange in core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
Runs a limited-range query on this database object.
Connection::queryTemporary in core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
Runs a SELECT query and stores its results in a temporary table.

File

core/lib/Drupal/Core/Database/Driver/mysql/Connection.php, line 355

Class

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

Namespace

Drupal\Core\Database\Driver\mysql

Code

public function query($query, array $args = [], $options = []) {
    try {
        return parent::query($query, $args, $options);
    } catch (DatabaseException $e) {
        if ($e->getPrevious()->errorInfo[1] == 1153) {
            // If a max_allowed_packet error occurs the message length is truncated.
            // This should prevent the error from recurring if the exception is
            // logged to the database using dblog or the like.
            $message = Unicode::truncateBytes($e->getMessage(), self::MIN_MAX_ALLOWED_PACKET);
            $e = new DatabaseExceptionWrapper($message, $e->getCode(), $e->getPrevious());
        }
        throw $e;
    }
}

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