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

Version Path
bonethug-0.0.17 skel/project_types/silverstripe3/public/abc/code/Classes/AbcDB.php
bonethug-0.0.16 skel/project_types/silverstripe3/public/abc/code/Classes/AbcDB.php
bonethug-0.0.15 skel/project_types/silverstripe3/public/abc/code/Classes/AbcDB.php
bonethug-0.0.14 skel/project_types/silverstripe3/public/abc/code/Classes/AbcDB.php
bonethug-0.0.13 skel/project_types/silverstripe3/public/abc/code/Classes/AbcDB.php
bonethug-0.0.12 skel/project_types/silverstripe3/public/abc/code/Classes/AbcDB.php
bonethug-0.0.11 skel/project_types/silverstripe3/public/abc/code/Classes/AbcDB.php
bonethug-0.0.10 skel/project_types/silverstripe3/public/abc/code/Classes/AbcDB.php
bonethug-0.0.7 skel/project_types/silverstripe3/public/abc/code/Classes/AbcDB.php
bonethug-0.0.6 skel/project_types/silverstripe3/public/abc/code/Classes/AbcDB.php
bonethug-0.0.5 skel/project_types/silverstripe3/public/abc/code/Classes/AbcDB.php