phpBB

Code Changes

File: includes/db/postgres.php

  Unmodified   Added   Modified   Removed
Line 17Line 17
}

include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);

}

include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);

 

if (!class_exists('phpbb_error_collector'))
{
include($phpbb_root_path . 'includes/error_collector.' . $phpEx);
}


/**
* PostgreSQL Database Abstraction Layer


/**
* PostgreSQL Database Abstraction Layer

Line 26Line 31
class dbal_postgres extends dbal
{
var $last_query_text = '';

class dbal_postgres extends dbal
{
var $last_query_text = '';

 
	var $connect_error = '';


/**
* Connect to server


/**
* Connect to server

Line 81Line 87

if ($this->persistency)
{


if ($this->persistency)
{

 
			if (!function_exists('pg_pconnect'))
{
$this->connect_error = 'pg_pconnect function does not exist, is pgsql extension installed?';
return $this->sql_error('');
}
$collector = new phpbb_error_collector;
$collector->install();

			$this->db_connect_id = (!$new_link) ? @pg_pconnect($connect_string) : @pg_pconnect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}
else
{

			$this->db_connect_id = (!$new_link) ? @pg_pconnect($connect_string) : @pg_pconnect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}
else
{

 
			if (!function_exists('pg_connect'))
{
$this->connect_error = 'pg_connect function does not exist, is pgsql extension installed?';
return $this->sql_error('');
}
$collector = new phpbb_error_collector;
$collector->install();

			$this->db_connect_id = (!$new_link) ? @pg_connect($connect_string) : @pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}

			$this->db_connect_id = (!$new_link) ? @pg_connect($connect_string) : @pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}

 

$collector->uninstall();


if ($this->db_connect_id)
{


if ($this->db_connect_id)
{

Line 102Line 124
			return $this->db_connect_id;
}


			return $this->db_connect_id;
}


 
		$this->connect_error = $collector->format_errors();

		return $this->sql_error('');
}


		return $this->sql_error('');
}


Line 371Line 394
	*/
function _sql_error()
{

	*/
function _sql_error()
{

 
		// pg_last_error only works when there is an established connection.
// Connection errors have to be tracked by us manually.
if ($this->db_connect_id)
{
$message = @pg_last_error($this->db_connect_id);
}
else
{
$message = $this->connect_error;
}


		return array(

		return array(

			'message'	=> (!$this->db_connect_id) ? @pg_last_error() : @pg_last_error($this->db_connect_id),

			'message'	=> $message,

			'code'		=> ''
);
}

			'code'		=> ''
);
}