Source of file AbcDB.php
Size: 0,964 Bytes - Last Modified: 2022-01-13T10:01:10+00:00
/var/www/docs.ssmods.com/process/src/src/abc/code/Classes/AbcDB.php
1234567891011121314151617181920212223242526272829303132333435363738 | <?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; // fix for sqlite dbs $type = strtolower(str_replace('Database', '', $conf->type)); if ($type == 'sqlitepdo') $type = 'sqlite'; if ($type == 'mysqlpdo') $type = 'mysql'; // DSN if (!$dsn) $dsn = $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; } } |