src/Factory.php
public static function &getDatabase($jname)
	{
		static $instances;
		if (!isset($instances)) {
			$instances = array();
		}
		//only create a new database instance if it has not been created before
		if (!isset($instances[$jname])) {
			/**
			 * TODO: MUST BE CHANGED! as do not rely on joomla_int
			 */
			if ($jname == 'joomla_int') {
				$db = self::getDBO();
			} else {
				//get config values
				$params = static::getParams($jname);
				//prepare the data for creating a database connection
				$host = $params->get('database_host');
				$user = $params->get('database_user');
				$password = $params->get('database_password');
				$database = $params->get('database_name');
				$prefix = $params->get('database_prefix', '');
				$driver = $params->get('database_type');
				$charset = $params->get('database_charset', 'utf8');
				//added extra code to prevent error when $driver is incorrect

				$options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix);

				$db = DatabaseFactory::getInstance()->getDriver($driver, $options);

				if ($driver != 'sqlite') {
					//add support for UTF8
					$db->setQuery('SET names ' . $db->quote($charset));
					$db->execute();
				}

				//get the debug configuration setting
				$db->setDebug(Config::get()->get('debug'));
			}
			$instances[$jname] = $db;
		}
		return $instances[$jname];
	}
public static function &getDatabase($jname)
	{
		static $instances;
		if (!isset($instances)) {
			$instances = array();
		}
		//only create a new database instance if it has not been created before
		if (!isset($instances[$jname])) {
			/**
			 * TODO: MUST BE CHANGED! as do not rely on joomla_int
			 */
			if ($jname == 'joomla_int') {
				$db = self::getDBO();
			} else {
				//get config values
				$params = static::getParams($jname);
				//prepare the data for creating a database connection
				$host = $params->get('database_host');
				$user = $params->get('database_user');
				$password = $params->get('database_password');
				$database = $params->get('database_name');
				$prefix = $params->get('database_prefix', '');
				$driver = $params->get('database_type');
				$charset = $params->get('database_charset', 'utf8');
				//added extra code to prevent error when $driver is incorrect

				$options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix);

				$db = DatabaseFactory::getInstance()->getDriver($driver, $options);

				if ($driver != 'sqlite') {
					//add support for UTF8
					$db->setQuery('SET names ' . $db->quote($charset));
					$db->execute();
				}

				//get the debug configuration setting
				$db->setDebug(Config::get()->get('debug'));
			}
			$instances[$jname] = $db;
		}
		return $instances[$jname];
	}
public static function & getDatabase ( $ jname ) { static $ instances ; if ( ! isset ( $ instances ) ) { $ instances = array ( ) ; } //only create a new database instance if it has not been created before if ( ! isset ( $ instances [ $ jname ] ) ) { /**
			 * TODO: MUST BE CHANGED! as do not rely on joomla_int
			 */ if ( $ jname == 'joomla_int' ) { $ db = self :: getDBO ( ) ; } else { //get config values $ params = static :: getParams ( $ jname ) ; //prepare the data for creating a database connection $ host = $ params -> get ( 'database_host' ) ; $ user = $ params -> get ( 'database_user' ) ; $ password = $ params -> get ( 'database_password' ) ; $ database = $ params -> get ( 'database_name' ) ; $ prefix = $ params -> get ( 'database_prefix' , '' ) ; $ driver = $ params -> get ( 'database_type' ) ; $ charset = $ params -> get ( 'database_charset' , 'utf8' ) ; //added extra code to prevent error when $driver is incorrect $ options = array ( 'driver' => $ driver , 'host' => $ host , 'user' => $ user , 'password' => $ password , 'database' => $ database , 'prefix' => $ prefix ) ; $ db = DatabaseFactory :: getInstance ( ) -> getDriver ( $ driver , $ options ) ; if ( $ driver != 'sqlite' ) { //add support for UTF8 $ db -> setQuery ( 'SET names ' . $ db -> quote ( $ charset ) ) ; $ db -> execute ( ) ; } //get the debug configuration setting $ db -> setDebug ( Config :: get ( ) -> get ( 'debug' ) ) ; } $ instances [ $ jname ] = $ db ; } return $ instances [ $ jname ] ; }
Gets an Database Connection for the JFusion Plugin

@param string $jname name of the JFusion plugin used

@return DatabaseDriver Database connection for the JFusion plugin
@throws  RuntimeException
Gets an Database Connection for the JFusion Plugin