Sha256: d0e3379989ce97622cdde706b8e64ead69ff0fa1e6197c1fe7a6e05ea6cb429f
Contents?: true
Size: 835 Bytes
Versions: 11
Compression:
Stored size: 835 Bytes
Contents
<?php class AbcDB extends PDO{ protected static $instance = null; public function __construct($dsn = null, $username = null, $password = null, array $driver_options = null){ // Get the System DB Config global $databaseConfig; // Make the config easier to work with $conf = (object) $databaseConfig; // DSN if (!$dsn) $dsn = strtolower(str_replace("Database", "", $conf->type)).":". "host=".$conf->server.";". "dbname=".$conf->database; // Authentication if (!$username) $username = $conf->username; if (!$password) $password = $conf->password; // Connect parent::__construct($dsn, $username, $password, $driver_options); } public static function getInstance(){ if (empty(self::$instance)) self::$instance = new self; return self::$instance; } }
Version data entries
11 entries across 11 versions & 1 rubygems