Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Connection.php

function Connection::__construct

Same name in this branch
  1. 11.1.x vendor/symfony/var-dumper/Server/Connection.php \Symfony\Component\VarDumper\Server\Connection::__construct()
  2. 11.1.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::__construct()
  3. 11.1.x core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::__construct()
  4. 11.1.x core/modules/mysql/src/Driver/Database/mysql/Connection.php \Drupal\mysql\Driver\Database\mysql\Connection::__construct()

Constructs a \Drupal\sqlite\Driver\Database\sqlite\Connection object.

Overrides Connection::__construct

File

core/modules/sqlite/src/Driver/Database/sqlite/Connection.php, line 78

Class

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

Namespace

Drupal\sqlite\Driver\Database\sqlite

Code

public function __construct(\PDO $connection, array $connection_options) {
    parent::__construct($connection, $connection_options);
    // Empty prefix means query the main database -- no need to attach anything.
    $prefix = $this->connectionOptions['prefix'] ?? '';
    if ($prefix !== '') {
        $this->attachDatabase($prefix);
        // Add a ., so queries become prefix.table, which is proper syntax for
        // querying an attached database.
        $prefix .= '.';
    }
    // Regenerate the prefix.
    $this->setPrefix($prefix);
}
RSS feed
Powered by Drupal