You are here

private function PdoSessionHandler::getSelectSql in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler::getSelectSql()

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

Return value

string The SQL string

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 632

Class

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

Namespace

Symfony\Component\HttpFoundation\Session\Storage\Handler

Code

private function getSelectSql() {
  if (self::LOCK_TRANSACTIONAL === $this->lockMode) {
    $this
      ->beginTransaction();
    switch ($this->driver) {
      case 'mysql':
      case 'oci':
      case 'pgsql':
        return "SELECT {$this->dataCol}, {$this->lifetimeCol}, {$this->timeCol} FROM {$this->table} WHERE {$this->idCol} = :id FOR UPDATE";
      case 'sqlsrv':
        return "SELECT {$this->dataCol}, {$this->lifetimeCol}, {$this->timeCol} 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}, {$this->timeCol} FROM {$this->table} WHERE {$this->idCol} = :id";
}