DbReg class improvements

This commit is contained in:
Timothy Warren 2012-03-30 18:40:06 -04:00
parent 1ea1896378
commit e7abfec149

View File

@ -7,14 +7,14 @@
* @author Timothy J. Warren
* @copyright Copyright (c) 2012
* @link https://github.com/aviat4ion/OpenSQLManager
* @license http://philsturgeon.co.uk/code/dbad-license
* @license http://philsturgeon.co.uk/code/dbad-license
*/
// --------------------------------------------------------------------------
/**
* Connection registry
*
*
* Decouples the Settings class from the query builder
* and organizes database connections
*/
@ -24,7 +24,7 @@ class DB_Reg {
/**
* Registry access method
*
*
* @param string $key
* @return object
*/
@ -43,9 +43,10 @@ class DB_Reg {
/**
* Private constructor
*
* @param string $key
*/
protected function __construct($key)
private function __construct($key)
{
// Get the db connection parameters for the current database
$db_params = Settings::get_instance()->get_db($key);
@ -53,4 +54,17 @@ class DB_Reg {
// Set the current key in the registry
self::$instance[$key] = new Query_Builder($db_params);
}
}
// --------------------------------------------------------------------------
/**
* Return exiting connections
*
* @return array
*/
public function get_connections()
{
return array_keys(self::$instance);
}
}
// End of dbreg.php