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

Breadcrumb

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

function PdoStore::createTable

Creates the table to store lock keys which can be called once for setup.

Throws

\PDOException When the table already exists

\DomainException When an unsupported PDO driver is used

1 call to PdoStore::createTable()
PdoStore::save in vendor/symfony/lock/Store/PdoStore.php
Stores the resource if it's not locked by someone else.

File

vendor/symfony/lock/Store/PdoStore.php, line 188

Class

PdoStore
PdoStore is a PersistingStoreInterface implementation using a PDO connection.

Namespace

Symfony\Component\Lock\Store

Code

public function createTable() : void {
    $sql = match ($driver = $this->getDriver()) {    'mysql' => "CREATE TABLE {$this->table} ({$this->idCol} VARCHAR(64) NOT NULL PRIMARY KEY, {$this->tokenCol} VARCHAR(44) NOT NULL, {$this->expirationCol} INTEGER UNSIGNED NOT NULL) COLLATE utf8mb4_bin, ENGINE = InnoDB",
        'sqlite' => "CREATE TABLE {$this->table} ({$this->idCol} TEXT NOT NULL PRIMARY KEY, {$this->tokenCol} TEXT NOT NULL, {$this->expirationCol} INTEGER)",
        'pgsql' => "CREATE TABLE {$this->table} ({$this->idCol} VARCHAR(64) NOT NULL PRIMARY KEY, {$this->tokenCol} VARCHAR(64) NOT NULL, {$this->expirationCol} INTEGER)",
        'oci' => "CREATE TABLE {$this->table} ({$this->idCol} VARCHAR2(64) NOT NULL PRIMARY KEY, {$this->tokenCol} VARCHAR2(64) NOT NULL, {$this->expirationCol} INTEGER)",
        'sqlsrv' => "CREATE TABLE {$this->table} ({$this->idCol} VARCHAR(64) NOT NULL PRIMARY KEY, {$this->tokenCol} VARCHAR(64) NOT NULL, {$this->expirationCol} INTEGER)",
        default => throw new \DomainException(\sprintf('Creating the lock table is currently not implemented for platform "%s".', $driver)),
    
    };
    $this->getConnection()
        ->exec($sql);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal