phpBB

Code Changes

File: phpbb/db/driver/postgres.php

  Unmodified   Added   Modified   Removed
Line 37Line 37

if ($sqlpassword)
{


if ($sqlpassword)
{

			$connect_string .= "password=$sqlpassword ";

			$connect_string .= "password='$sqlpassword' ";

		}

if ($sqlserver)

		}

if ($sqlserver)

Line 188Line 188

if ($this->query_result === false)
{


if ($this->query_result === false)
{

				if (($this->query_result = @pg_query($this->db_connect_id, $query)) === false)










				try
{
$this->query_result = @pg_query($this->db_connect_id, $query);
}
catch (\Error $e)
{
// Do nothing as SQL driver will report the error
}

if ($this->query_result === false)

				{
$this->sql_error($query);
}

				{
$this->sql_error($query);
}

Line 206Line 215
				{
return false;
}

				{
return false;
}

 

$safe_query_id = $this->clean_query_id($this->query_result);


if ($cache && $cache_ttl)
{


if ($cache && $cache_ttl)
{

					$this->open_queries[(int) $this->query_result] = $this->query_result;

					$this->open_queries[$safe_query_id] = $this->query_result;

					$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
}
else if (strpos($query, 'SELECT') === 0)
{

					$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
}
else if (strpos($query, 'SELECT') === 0)
{

					$this->open_queries[(int) $this->query_result] = $this->query_result;

					$this->open_queries[$safe_query_id] = $this->query_result;

				}
}
else if ($this->debug_sql_explain)

				}
}
else if ($this->debug_sql_explain)

Line 277Line 288
			$query_id = $this->query_result;
}


			$query_id = $this->query_result;
}


		if ($cache && $cache->sql_exists($query_id))


		$safe_query_id = $this->clean_query_id($query_id);
if ($cache && $cache->sql_exists($safe_query_id))

		{

		{

			return $cache->sql_fetchrow($query_id);

			return $cache->sql_fetchrow($safe_query_id);

		}

return ($query_id) ? pg_fetch_assoc($query_id, null) : false;

		}

return ($query_id) ? pg_fetch_assoc($query_id, null) : false;

Line 297Line 309
			$query_id = $this->query_result;
}


			$query_id = $this->query_result;
}


		if ($cache && $cache->sql_exists($query_id))


		$safe_query_id = $this->clean_query_id($query_id);
if ($cache && $cache->sql_exists($safe_query_id))

		{

		{

			return $cache->sql_rowseek($rownum, $query_id);

			return $cache->sql_rowseek($rownum, $safe_query_id);

		}

return ($query_id) ? @pg_result_seek($query_id, $rownum) : false;

		}

return ($query_id) ? @pg_result_seek($query_id, $rownum) : false;

Line 308Line 321
	/**
* {@inheritDoc}
*/

	/**
* {@inheritDoc}
*/

	function sql_nextid()

































	function sql_fetchfield($field, $rownum = false, $query_id = false)
{
global $cache;

if ($query_id === false)
{
$query_id = $this->query_result;
}

if ($query_id)
{
if ($rownum !== false)
{
$this->sql_rowseek($rownum, $query_id);
}

$safe_query_id = $this->clean_query_id($query_id);
if ($cache && !is_object($query_id) && $cache->sql_exists($safe_query_id))
{
return $cache->sql_fetchfield($safe_query_id, $field);
}

$row = $this->sql_fetchrow($query_id);
return (isset($row[$field])) ? $row[$field] : false;
}

return false;
}

/**
* {@inheritdoc}
*/
public function sql_last_inserted_id()

	{
$query_id = $this->query_result;


	{
$query_id = $this->query_result;


Line 346Line 391
			$query_id = $this->query_result;
}


			$query_id = $this->query_result;
}


		if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))


		$safe_query_id = $this->clean_query_id($query_id);
if ($cache && !is_object($query_id) && $cache->sql_exists($safe_query_id))

		{

		{

			return $cache->sql_freeresult($query_id);

			return $cache->sql_freeresult($safe_query_id);

		}


		}


		if (isset($this->open_queries[(int) $query_id]))

		if (isset($this->open_queries[$safe_query_id]))

		{

		{

			unset($this->open_queries[(int) $query_id]);

			unset($this->open_queries[$safe_query_id]);

			return pg_free_result($query_id);
}


			return pg_free_result($query_id);
}


Line 431Line 477
	*/
function _sql_close()
{

	*/
function _sql_close()
{

 
		// Released resources are already closed, return true in this case
if (!is_resource($this->db_connect_id))
{
return true;
}

		return @pg_close($this->db_connect_id);
}


		return @pg_close($this->db_connect_id);
}


Line 496Line 547

break;
}


break;
}

 
	}

/**
* {@inheritDoc}
*/
function sql_quote($msg)
{
return '"' . $msg . '"';

	}
}


	}
}