Database
in package
Database Connection Factory
Creates and returns an instance of the appropriate DatabaseConnection
Table of Contents
- $connections : array<string|int, mixed>
- Maintains an array of the instances of all connections that have been created.
- loadForge() : object
- Creates a Forge instance for the current database type.
- loadUtils() : object
- Creates a Utils instance for the current database type.
- initDriver() : object
- Initialize database driver.
- parseDSN() : array<string|int, mixed>
- Parse universal DSN string
Properties
$connections
Maintains an array of the instances of all connections that have been created.
protected
array<string|int, mixed>
$connections
= []
Helps to keep track of all open connections for performance monitoring, logging, etc.
Methods
loadForge()
Creates a Forge instance for the current database type.
public
loadForge(ConnectionInterface $db) : object
Parameters
- $db : ConnectionInterface
Return values
object —loadUtils()
Creates a Utils instance for the current database type.
public
loadUtils(ConnectionInterface $db) : object
Parameters
- $db : ConnectionInterface
Return values
object —initDriver()
Initialize database driver.
protected
initDriver(string $driver, string $class, array<string|int, mixed>|object $argument) : object
Parameters
- $driver : string
-
Database driver name (e.g. 'MySQLi')
- $class : string
-
Database class name (e.g. 'Forge')
- $argument : array<string|int, mixed>|object
Return values
object —parseDSN()
Parse universal DSN string
protected
parseDSN(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>