izartu API

Database
in package

The shared PDO connection.

Table of Contents

Properties

$db  : PDO

Methods

__construct()  : mixed
Open the shared database connection, once.
pdoMySQL()  : string
Build the MySQL DSN string from the configured `DB_*` constants.

Properties

$db

protected static PDO $db

Shared PDO connection, created once on first construction.

Methods

__construct()

Open the shared database connection, once.

public final __construct() : mixed

The first instantiation builds it from the DB_* constants and the rest reuse it; a failure triggers E_USER_ERROR. With DEBUG on, statements are created as DebugStatement so every query execution is timed.

Prepared statements are native, so integer columns come back as int; the charset is utf8mb4 and the timezone is the server's.

pdoMySQL()

Build the MySQL DSN string from the configured `DB_*` constants.

private pdoMySQL() : string
Return values
string

PDO DSN (TCP host/port or Unix socket, plus database name).

On this page

Search results