The method Drupal\Core\Database\Connection::getDriverClass() has been conditionally deprecated for some of the database classes in Drupal 10.2. There is no replacement for this other then to use standard autoloading in the methods that return database operations.
For all developers (with the exception of the maintainers of a database driver)
Nothing will change.
For the maintainers of a database driver
Database drivers' Connection class will need to add the following code or something very similar:
/**
* {@inheritdoc}
*/
public function exceptionHandler() {
return new ExceptionHandler();
}
/**
* {@inheritdoc}
*/
public function select($table, $alias = NULL, array $options = []) {
return new Select($this, $table, $alias, $options);
}
/**
* {@inheritdoc}
*/
public function insert($table, array $options = []) {
return new Insert($this, $table, $options);
}
/**
* {@inheritdoc}
*/
public function merge($table, array $options = []) {
return new Merge($this, $table, $options);
}
/**
* {@inheritdoc}
*/
public function upsert($table, array $options = []) {
return new Upsert($this, $table, $options);
}
/**
* {@inheritdoc}
*/
public function update($table, array $options = []) {
return new Update($this, $table, $options);
}
/**
* {@inheritdoc}
*/
public function delete($table, array $options = []) {
return new Delete($this, $table, $options);
}
/**
* {@inheritdoc}
*/
public function truncate($table, array $options = []) {
return new Truncate($this, $table, $options);
}
/**
* {@inheritdoc}
*/
public function schema() {
if (empty($this->schema)) {
$this->schema = new Schema($this);
}
return $this->schema;
}
/**
* {@inheritdoc}
*/
public function condition($conjunction) {
return new Condition($conjunction, FALSE);
}
/**
* {@inheritdoc}
*/
public function startTransaction($name = '') {
return new Transaction($this, $name);
}
With adding a use-statement they can import the default implementation from Drupal\Core\Database or Drupal\Core\Database\Query instead of the overridden version from their own drivers directory.
It cannot be done in another way as the methods in the class Drupal\Core\Database\Connection are all using the method Drupal\Core\Database\Connection::getDriverClass() and changing that will make the return value fundamentally different.
The replacement for the database class "Install\Tasks" is:
// Before
$class = Database::getConnection()->getDriverClass('Install\\Tasks');
// Replacement
$class = Database::getConnection()->getConnectionOptions()['namespace'] . '\\Install\\Tasks';