You are here

public function Connection::getDriverClass in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::getDriverClass()

Gets the driver-specific override class if any for the specified class.

Parameters

string $class: The class for which we want the potentially driver-specific class.

Return value

string The name of the class that should be used for this driver.

11 calls to Connection::getDriverClass()
Connection::condition in core/lib/Drupal/Core/Database/Connection.php
Prepares and returns a CONDITION query object.
Connection::delete in core/lib/Drupal/Core/Database/Connection.php
Prepares and returns a DELETE query object.
Connection::exceptionHandler in core/lib/Drupal/Core/Database/Connection.php
Returns the database exceptions handler.
Connection::insert in core/lib/Drupal/Core/Database/Connection.php
Prepares and returns an INSERT query object.
Connection::merge in core/lib/Drupal/Core/Database/Connection.php
Prepares and returns a MERGE query object.

... See full list

File

core/lib/Drupal/Core/Database/Connection.php, line 1096

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function getDriverClass($class) {
  if (empty($this->driverClasses[$class])) {
    $driver_class = $this->connectionOptions['namespace'] . '\\' . $class;
    if (class_exists($driver_class)) {
      $this->driverClasses[$class] = $driver_class;
    }
    else {
      switch ($class) {
        case 'Condition':
          $this->driverClasses[$class] = Condition::class;
          break;
        case 'Delete':
          $this->driverClasses[$class] = Delete::class;
          break;
        case 'ExceptionHandler':
          $this->driverClasses[$class] = ExceptionHandler::class;
          break;
        case 'Insert':
          $this->driverClasses[$class] = Insert::class;
          break;
        case 'Merge':
          $this->driverClasses[$class] = Merge::class;
          break;
        case 'Schema':
          $this->driverClasses[$class] = Schema::class;
          break;
        case 'Select':
          $this->driverClasses[$class] = Select::class;
          break;
        case 'Transaction':
          $this->driverClasses[$class] = Transaction::class;
          break;
        case 'Truncate':
          $this->driverClasses[$class] = Truncate::class;
          break;
        case 'Update':
          $this->driverClasses[$class] = Update::class;
          break;
        case 'Upsert':
          $this->driverClasses[$class] = Upsert::class;
          break;
        default:
          $this->driverClasses[$class] = $class;
      }
    }
  }
  return $this->driverClasses[$class];
}