src/DB/MySQL/Connection.php
public function connectDatabase( $type, $host, $user, $pass, $database = NULL )
	{
		switch( $type )
		{
			case 'connect':
				$resource	= mysql_connect( $host, $user, $pass );
				break;
			case 'pconnect':
				$resource	= mysql_pconnect( $host, $user, $pass );
				break;
			default:
				throw new InvalidArgumentException( 'Database Connection Type "'.$type.'" is invalid' );
		}
		if( !$resource )
			throw new Exception( 'Database Connection failed for User "'.$user.'@'.$host.'"' );
		$this->dbc			= $resource;
		if( $database )
			return $this->selectDB( $database );
		return TRUE;
	}
public function connectDatabase( $type, $host, $user, $pass, $database = NULL )
	{
		switch( $type )
		{
			case 'connect':
				$resource	= mysql_connect( $host, $user, $pass );
				break;
			case 'pconnect':
				$resource	= mysql_pconnect( $host, $user, $pass );
				break;
			default:
				throw new InvalidArgumentException( 'Database Connection Type "'.$type.'" is invalid' );
		}
		if( !$resource )
			throw new Exception( 'Database Connection failed for User "'.$user.'@'.$host.'"' );
		$this->dbc			= $resource;
		if( $database )
			return $this->selectDB( $database );
		return TRUE;
	}
public function connectDatabase ( $ type , $ host , $ user , $ pass , $ database = NULL ) { switch ( $ type ) { case 'connect' : $ resource = mysql_connect ( $ host , $ user , $ pass ) ; break ; case 'pconnect' : $ resource = mysql_pconnect ( $ host , $ user , $ pass ) ; break ; default : throw new InvalidArgumentException ( 'Database Connection Type "' . $ type . '" is invalid' ) ; } if ( ! $ resource ) throw new Exception ( 'Database Connection failed for User "' . $ user . '@' . $ host . '"' ) ; $ this -> dbc = $ resource ; if ( $ database ) return $ this -> selectDB ( $ database ) ; return TRUE ; }
Sets up a Database Connection.
@access		public
@param		string		$type		Connection Type (connect|pconnect)
@param		string		$host		Database Host Name
@param		string		$user		Database User Name
@param		string		$pass		Database User Password
@param		string		$database	Database to select
@return		bool		Flag: Database Connection established
Sets up a Database Connection .