Abstract Class Yiisoft\Db\Driver\Pdo\AbstractPdoDriver
| Inheritance | Yiisoft\Db\Driver\Pdo\AbstractPdoDriver |
|---|---|
| Implements | Yiisoft\Db\Driver\Pdo\PdoDriverInterface |
Serves as the base class for creating PDO (PHP Data Objects) drivers.
It provides a set of common methods and properties that are implemented by the specific PDO driver classes, such as MSSQL, Mysql, MariaDb, Oracle, PostgreSQL, and SQLite.
Protected Properties
Public Methods
Property Details
Method Details
| public mixed __construct ( string|\Stringable $dsn, string $username = '', string $password = '', array $attributes = [] ) | ||
| $dsn | string|\Stringable | |
| $username | string | |
| $password | string | |
| $attributes | array | |
public function __construct(
string|Stringable $dsn,
protected string $username = '',
#[SensitiveParameter]
protected string $password = '',
protected array $attributes = [],
) {
$this->dsn = (string) $dsn;
}
| public void attributes ( array $attributes ) | ||
| $attributes | array | |
public function attributes(array $attributes): void
{
$this->attributes = $attributes;
}
| public void charset ( string|null $charset ) | ||
| $charset | string|null | |
public function charset(?string $charset): void
{
$this->charset = $charset;
}
| public PDO createConnection ( ) |
public function createConnection(): PDO
{
return new PDO($this->dsn, $this->username, $this->password, $this->attributes);
}
| public abstract string getDriverName ( ) | ||
| return | string |
The driver name for DB connection. |
|---|---|---|
public function getDriverName(): string;
| public void password ( string $password ) | ||
| $password | string | |
public function password(#[SensitiveParameter] string $password): void
{
$this->password = $password;
}
Signup or Login in order to comment.