Interface Yiisoft\Db\Driver\Pdo\PdoDriverInterface
| Extends | Yiisoft\Db\Driver\DriverInterface |
|---|---|
| Implemented by | Yiisoft\Db\Driver\Pdo\AbstractPdoDriver |
This interface provides a set of methods to implement by {@see PDO} (PHP Data Objects) driver classes.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| attributes() | Set {@see PDO} attributes (name => value) to set when calling {@see open()} to establish a DB connection. | Yiisoft\Db\Driver\Pdo\PdoDriverInterface |
| charset() | Set charset used for database connection. The property is only used for MySQL, PostgresSQL databases. Defaults to
null, meaning using default charset as configured by the database. |
Yiisoft\Db\Driver\Pdo\PdoDriverInterface |
| createConnection() | Creates a {@see PDO} instance representing a connection to a database. | Yiisoft\Db\Driver\Pdo\PdoDriverInterface |
| getCharset() | Yiisoft\Db\Driver\Pdo\PdoDriverInterface | |
| getDriverName() | Yiisoft\Db\Driver\Pdo\PdoDriverInterface | |
| getDsn() | Yiisoft\Db\Driver\Pdo\PdoDriverInterface | |
| getPassword() | Yiisoft\Db\Driver\Pdo\PdoDriverInterface | |
| getUsername() | Yiisoft\Db\Driver\Pdo\PdoDriverInterface | |
| password() | Set password for establishing DB connection. Defaults to null meaning use no password. |
Yiisoft\Db\Driver\Pdo\PdoDriverInterface |
| username() | Set username for establishing DB connection. Defaults to null meaning use no username. |
Yiisoft\Db\Driver\Pdo\PdoDriverInterface |
Method Details
Set {@see PDO} attributes (name => value) to set when calling {@see open()} to establish a DB connection.
Please refer to the PHP manual for details about available attributes.
| public abstract void attributes ( array $attributes ) | ||
| $attributes | array |
The attributes (name => value) to set on the DB connection. |
public function attributes(array $attributes): void;
Set charset used for database connection. The property is only used for MySQL, PostgresSQL databases. Defaults to
null, meaning using default charset as configured by the database.
For Oracle Database, the charset must be specified in the {@see \Yiisoft\Db\Driver\Pdo\dsn}, for example, for UTF-8 by appending
;charset=UTF-8 to the DSN string.
The same applies if you're using GBK or BIG5 charset with MySQL.
In this case it's highly recommended specifying
charset via {@see \Yiisoft\Db\Driver\Pdo\dsn} like 'mysql:dbname=database;host=127.0.0.1;charset=GBK;'.
| public abstract void charset ( string|null $charset ) | ||
| $charset | string|null |
The charset to use for database connection. |
public function charset(?string $charset): void;
Creates a {@see PDO} instance representing a connection to a database.
| public abstract PDO createConnection ( ) | ||
| return | PDO |
The created {@see \PDO} instance. |
|---|---|---|
public function createConnection(): PDO;
| public abstract string|null getCharset ( ) | ||
| return | string|null |
The charset of the pdo instance. If the charset isn't set yet or not
supported by the PDO driver, it returns |
|---|---|---|
public function getCharset(): ?string;
| public abstract string getDriverName ( ) | ||
| return | string |
The driver name for DB connection. |
|---|---|---|
public function getDriverName(): string;
| public abstract string getDsn ( ) | ||
| return | string |
The DSN string for creating a PDO instance. |
|---|---|---|
public function getDsn(): string;
| public abstract string getPassword ( ) | ||
| return | string |
The password for establishing DB connection. |
|---|---|---|
public function getPassword(): string;
| public abstract string getUsername ( ) | ||
| return | string |
The username for establishing DB connection. |
|---|---|---|
public function getUsername(): string;
Set password for establishing DB connection. Defaults to null meaning use no password.
| public abstract void password ( string $password ) | ||
| $password | string |
The password for establishing DB connection. |
public function password(string $password): void;
Signup or Login in order to comment.