Changeset 2992
- Timestamp:
- 07/07/2008 08:25:50 PM (3 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/Database.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/Database.php
r2905 r2992 11 11 */ 12 12 class Database_Core { 13 14 // Database instances 15 public static $instances = array(); 13 16 14 17 // Global benchmark … … 53 56 * @return Database_Core 54 57 */ 55 public static function instance($config = array()) 56 { 57 static $instance; 58 59 // Create the instance if it does not exist 60 ($instance === NULL) and $instance = new Database($config); 61 62 return $instance; 58 public static function instance($name = 'default', $config = NULL) 59 { 60 if ( ! isset(Database::$instances[$name])) 61 { 62 // Create a new instance 63 Database::$instances[$name] = new Database($config === NULL ? $name : $config); 64 } 65 66 return Database::$instances[$name]; 63 67 } 64 68
