CoreFiles by mySites.guru
database.php53 lines, 1,386 bytes, from Joomla_2.5.0-Stable-Full_Package.zip
Raw History Compare with 1.7.5
md5
012c01df70a56b04187442285eaaed84
sha1
d00013b5af84d499a3c74f115504a9241cabb934
sha256
92b293787be078b89bfaeeee401097b0bb0d171de9bddd3b01c58c020d46c6fe
<?php
/**
 * @package		Joomla.Installation
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

/**
 * Joomla Installation Database Helper Class.
 *
 * @static
 * @package		Joomla.Installation
 * @since		1.6
 */
class JInstallationHelperDatabase
{
	/**
	 * Method to get a JDatabase object.
	 *
	 * @param	string	$driver		The database driver to use.
	 * @param	string	$host		The hostname to connect on.
	 * @param	string	$user		The user name to connect with.
	 * @param	string	$password	The password to use for connection authentication.
	 * @param	string	$database	The database to use.
	 * @param	string	$prefix		The table prefix to use.
	 * @param	boolean $select		True if the database should be selected.
	 *
	 * @return	mixed	JDatabase object on success, JException on error.
	 * @since	1.0
	 */
	public static function & getDBO($driver, $host, $user, $password, $database, $prefix, $select = true)
	{
		static $db;

		if (!$db) {
			// Build the connection options array.
			$options = array (
				'driver' => $driver,
				'host' => $host,
				'user' => $user,
				'password' => $password,
				'database' => $database,
				'prefix' => $prefix,
				'select' => $select
			);

			// Get a database object.
			$db = JDatabase::getInstance($options);
		}

		return $db;
	}
}

The same content is in 4 releases, Joomla 2.5.0 to 2.5.3. See them all, or every version of this file.