CodeIgniter v4.5 API

Database
in package

Database Connection Factory

Creates and returns an instance of the appropriate Database Connection.

Table of Contents

Properties

$connections  : array<string|int, mixed>
Maintains an array of the instances of all connections that have been created.

Methods

load()  : BaseConnection
Parses the connection binds and creates a Database Connection instance.
loadForge()  : Forge
Creates a Forge instance for the current database type.
loadUtils()  : BaseUtils
Creates an instance of Utils for the current database type.
initDriver()  : BaseConnection|BaseUtils|Forge
Creates a database object.
parseDSN()  : array<string|int, mixed>
Parses universal DSN string
checkDbExtension()  : bool
Check the PHP database extension is loaded.

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

load()

Parses the connection binds and creates a Database Connection instance.

public load([array<string|int, mixed> $params = [] ][, string $alias = '' ]) : BaseConnection
Parameters
$params : array<string|int, mixed> = []
$alias : string = ''
Tags
throws
InvalidArgumentException
Return values
BaseConnection

parseDSN()

Parses universal DSN string

protected parseDSN(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Tags
throws
InvalidArgumentException
Return values
array<string|int, mixed>

checkDbExtension()

Check the PHP database extension is loaded.

private checkDbExtension(string $driver) : bool
Parameters
$driver : string

DB driver or FQCN for custom driver

Return values
bool

        
On this page

Search results