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 PDO (PHP Data Objects) driver classes.

Public Methods

Hide inherited methods

Method Description Defined By
attributes() Set PDO attributes (name => value) to set when calling 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 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 PDO attributes (name => value) to set when calling open() to establish a DB connection.

Please refer to the PHP manual for details about available attributes.

public abstract attributes( array $attributes ): void
$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 \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 \Yiisoft\Db\Driver\Pdo\dsn like 'mysql:dbname=database;host=127.0.0.1;charset=GBK;'.

public abstract charset( string|null $charset ): void
$charset string|null

The charset to use for database connection.

                public function charset(?string $charset): void;

            
createConnection() public abstract method

Creates a PDO instance representing a connection to a database.

public abstract createConnection( ): PDO
return PDO

The created PDO instance.

                public function createConnection(): PDO;

            
getCharset() public abstract method

public abstract getCharset( ): string|null
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 getDriverName( ): string
return string

The driver name for DB connection.

                public function getDriverName(): string;

            
getDsn() public abstract method

public abstract getDsn( ): string
return string

The DSN string for creating a PDO instance.

                public function getDsn(): string;

            
getPassword() public abstract method

public abstract getPassword( ): string
return string

The password for establishing DB connection.

                public function getPassword(): string;

            
getUsername() public abstract method

public abstract getUsername( ): string
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 password( string $password ): void
$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 username( string $username ): void
$username string

The username for establishing DB connection.

                public function username(string $username): void;