0 follower

Interface Yiisoft\Db\Driver\Pdo\PdoDriverInterface

ExtendsYiisoft\Db\Driver\DriverInterface
Implemented byYiisoft\Db\Driver\Pdo\AbstractPdoDriver

This interface provides a set of methods to implement by {@see PDO} (PHP Data Objects) driver classes.

Public Methods

Hide inherited 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

Hide inherited methods

attributes() public abstract method

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;

            
charset() public abstract method

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;

            
createConnection() public abstract method

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;

            
getCharset() public abstract method

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 null.

                public function getCharset(): ?string;

            
getDriverName() public abstract method

public abstract string getDriverName ( )
return string

The driver name for DB connection.

                public function getDriverName(): string;

            
getDsn() public abstract method

public abstract string getDsn ( )
return string

The DSN string for creating a PDO instance.

                public function getDsn(): string;

            
getPassword() public abstract method

public abstract string getPassword ( )
return string

The password for establishing DB connection.

                public function getPassword(): string;

            
getUsername() public abstract method

public abstract string getUsername ( )
return string

The username for establishing DB connection.

                public function getUsername(): string;

            
password() public abstract method

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;

            
username() public abstract method

Set username for establishing DB connection. Defaults to null meaning use no username.

public abstract void username ( string $username )
$username string

The username for establishing DB connection.

                public function username(string $username): void;