From: <al...@us...> - 2008-07-08 03:35:40
|
Revision: 602 http://sciret.svn.sourceforge.net/sciret/?rev=602&view=rev Author: alpeb Date: 2008-07-07 20:35:38 -0700 (Mon, 07 Jul 2008) Log Message: ----------- slowly moving to zend framework. This class will be discarded later Modified Paths: -------------- branches/release-candidates/sciret-1.2/classes/DB.php Modified: branches/release-candidates/sciret-1.2/classes/DB.php =================================================================== --- branches/release-candidates/sciret-1.2/classes/DB.php 2008-07-08 03:35:04 UTC (rev 601) +++ branches/release-candidates/sciret-1.2/classes/DB.php 2008-07-08 03:35:38 UTC (rev 602) @@ -1,40 +1,20 @@ <?php -/* -* @copyright Copyright (C) 2005-2007 TheGang http://www.the-gang.net -* @license http://www.fsf.org/copyleft/lgpl.html GNU Lesser General Public License -* @author Alejandro Pedraza -* @since Sciret 1.0 -* @package Sciret -* @packager TheGang -*/ - class DB { - // singleton PHP 4 hack - function DB($calledFromConnect = false) - { - if (!$calledFromConnect) { - trigger_error('Cannot instantiate class DB directly', E_USER_ERROR); - } - } + private static $instance; + + private static $skipFatalError = false; - // Database factory - // @access static - function &DBFactory($dbEngine, $dbHost, $dbUser, $dbPassword, $reconnect = false) { - static $db; + private function __construct() {} - $dbEngine = strtolower($dbEngine); + public static function setDBInstance($dbInstance) { + self::$instance =& $dbInstance; + } - if (!is_object($db) || $reconnect) { - switch ($dbEngine) { - default: - require_once 'classes/Mysql.php'; - $db = new MySQL($dbHost, $dbUser, $dbPassword); - } - } - - return $db; + public static function getInstance() + { + return self::$instance; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |