Loader
extends CI_Loader
in package
Extended CodeIgniter Loader class.
Provides enhanced database loading with custom query builder support.
Usage:
// In controller, load default database
$this->load->database();
// Load specific connection group
$this->load->database('secondary');
// Get database instance directly
$db = $this->load->database('default', true);
Table of Contents
Methods
- database() : DB|Loader|false
- Load database connection.
Methods
database()
Load database connection.
public
database([mixed $config = '' ][, bool $return = false ][, mixed $queryBuilder = null ]) : DB|Loader|false
Parameters
- $config : mixed = ''
-
Connection group name or database configuration array. Default is 'default'.
- $return : bool = false
-
Return the database object instead of assigning to CI instance. Default is false.
- $queryBuilder : mixed = null
-
Custom query builder instance to use.
Return values
DB|Loader|false —Database object if $return is true, Loader instance otherwise, false on failure.