CoreFiles by mySites.guru
database.php55 lines, 1,498 bytes, from Joomla_1.7.0-Stable-Full_Package.zip
Raw History Compare with 1.6.6
md5
e43b862c189b7d3588ebe049e8856717
sha1
6851f416d269542fd169b99c6eece82cb09b65bb
sha256
ce02503fb6bd4ef193bb046f87f373192018fb46de6341e81fe3ca5e3a0a86b1
<?php
/**
 * @version		$Id: database.php 21376 2011-05-24 17:11:48Z dextercowley $
 * @package		Joomla.Installation
 * @copyright	Copyright (C) 2005 - 2011 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.
			jimport('joomla.database.database');
			$db = JDatabase::getInstance($options);
		}

		return $db;
	}
}

The same content is in 3 releases, Joomla 1.7.0 to 1.7.2. See them all, or every version of this file.