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 and namespace in other branches
  1. 11.x core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::query()
  2. 11.x 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. 9 core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::query()
  6. 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::query()

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.