Final Class Yiisoft\Db\Sqlite\Dsn
| Inheritance | Yiisoft\Db\Sqlite\Dsn |
|---|---|
| Implements | Stringable |
Represents a Data Source Name (DSN) for a SQLite Server that's used to configure a {@see Driver} instance.
To get DSN in string format, use the (string) type casting operator.
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $databaseName | string | Yiisoft\Db\Sqlite\Dsn | |
| $driver | string | Yiisoft\Db\Sqlite\Dsn |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Db\Sqlite\Dsn | |
| __toString() | Yiisoft\Db\Sqlite\Dsn |
Property Details
Method Details
| public mixed __construct ( string $driver = 'sqlite', string $databaseName = '' ) | ||
| $driver | string |
The database driver name. |
| $databaseName | string |
The database name to connect to. It can be
|
public function __construct(
public readonly string $driver = 'sqlite',
public readonly string $databaseName = '',
) {}
| public string __toString ( ) | ||
| return | string |
The Data Source Name, or DSN, has the information required to connect to the database. Please refer to the PHP manual on the format of the DSN string. The
Will result in the DSN string |
|---|---|---|
public function __toString(): string
{
if ($this->databaseName === 'memory') {
return "$this->driver::memory:";
}
return "$this->driver:$this->databaseName";
}
Signup or Login in order to comment.