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

Breadcrumb

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

function PdoSessionHandler::getSelectSql

Return a locking or nonlocking SQL query to read session information.

Throws

\DomainException When an unsupported PDO driver is used

1 call to PdoSessionHandler::getSelectSql()
PdoSessionHandler::doRead in vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
Reads the session data in respect to the different locking strategies.

File

vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php, line 761

Class

PdoSessionHandler
Session handler using a PDO connection to read and write data.

Namespace

Symfony\Component\HttpFoundation\Session\Storage\Handler

Code

private function getSelectSql() : string {
    if (self::LOCK_TRANSACTIONAL === $this->lockMode) {
        $this->beginTransaction();
        switch ($this->driver) {
            case 'mysql':
            case 'oci':
            case 'pgsql':
                return "SELECT {$this->dataCol}, {$this->lifetimeCol} FROM {$this->table} WHERE {$this->idCol} = :id FOR UPDATE";
            case 'sqlsrv':
                return "SELECT {$this->dataCol}, {$this->lifetimeCol} FROM {$this->table} WITH (UPDLOCK, ROWLOCK) WHERE {$this->idCol} = :id";
            case 'sqlite':
                // we already locked when starting transaction
                break;
            default:
                throw new \DomainException(\sprintf('Transactional locks are currently not implemented for PDO driver "%s".', $this->driver));
        }
    }
    return "SELECT {$this->dataCol}, {$this->lifetimeCol} FROM {$this->table} WHERE {$this->idCol} = :id";
}

API Navigation

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