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 __construct( string|\Stringable $dsn, string $username = '', string $password = '', array $attributes = [] ): mixed | ||
| $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 attributes( array $attributes ): void | ||
| $attributes | array | |
public function attributes(array $attributes): void
{
$this->attributes = $attributes;
}
| public charset( string|null $charset ): void | ||
| $charset | string|null | |
public function charset(?string $charset): void
{
$this->charset = $charset;
}
| public createConnection( ): PDO |
public function createConnection(): PDO
{
return new PDO($this->dsn, $this->username, $this->password, $this->attributes);
}
| public abstract getDriverName( ): string | ||
| return | string |
The driver name for DB connection. |
|---|---|---|
public function getDriverName(): string;
| public password( string $password ): void | ||
| $password | string | |
public function password(#[SensitiveParameter] string $password): void
{
$this->password = $password;
}
Signup or Login in order to comment.