phpBB

Code Changes

File: phpbb/db/driver/mysqli.php

  Unmodified   Added   Modified   Removed
Line 34Line 34
			return $this->sql_error('');
}


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


		// Mysqli extension supports persistent connection since PHP 5.3.0
$this->persistency = (version_compare(PHP_VERSION, '5.3.0', '>=')) ? $persistency : false;

		$this->persistency = $persistency;


		$this->user = $sqluser;

// If persistent connection, set dbhost to localhost when empty and prepend it with 'p:' prefix

		$this->user = $sqluser;

// If persistent connection, set dbhost to localhost when empty and prepend it with 'p:' prefix

Line 75Line 74
			if (version_compare($this->sql_server_info(true), '5.0.2', '>='))
{
$result = @mysqli_query($this->db_connect_id, 'SELECT @@session.sql_mode AS sql_mode');

			if (version_compare($this->sql_server_info(true), '5.0.2', '>='))
{
$result = @mysqli_query($this->db_connect_id, 'SELECT @@session.sql_mode AS sql_mode');

				if ($result !== null)

				if ($result)

				{

				{

					$row = @mysqli_fetch_assoc($result);


					$row = mysqli_fetch_assoc($result);
mysqli_free_result($result);


$modes = array_map('trim', explode(',', $row['sql_mode']));
}


$modes = array_map('trim', explode(',', $row['sql_mode']));
}

Line 85Line 85
				{
$modes = array();
}

				{
$modes = array();
}

				@mysqli_free_result($result);

 

// TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES
if (!in_array('TRADITIONAL', $modes))


// TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES
if (!in_array('TRADITIONAL', $modes))

Line 120Line 119
		if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysqli_version')) === false)
{
$result = @mysqli_query($this->db_connect_id, 'SELECT VERSION() AS version');

		if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysqli_version')) === false)
{
$result = @mysqli_query($this->db_connect_id, 'SELECT VERSION() AS version');

			if ($result !== null)

			if ($result)

			{

			{

				$row = @mysqli_fetch_assoc($result);


				$row = mysqli_fetch_assoc($result);
mysqli_free_result($result);


$this->sql_server_version = $row['version'];



$this->sql_server_version = $row['version'];


Line 131Line 131
					$cache->put('mysqli_version', $this->sql_server_version);
}
}

					$cache->put('mysqli_version', $this->sql_server_version);
}
}

			@mysqli_free_result($result);

 
		}

return ($raw) ? $this->sql_server_version : 'MySQL(i) ' . $this->sql_server_version;

		}

return ($raw) ? $this->sql_server_version : 'MySQL(i) ' . $this->sql_server_version;

Line 201Line 200
				else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
{
$this->sql_time += microtime(true) - $this->curtime;

				else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
{
$this->sql_time += microtime(true) - $this->curtime;

 
				}

if (!$this->query_result)
{
return false;

				}

if ($cache && $cache_ttl)

				}

if ($cache && $cache_ttl)

Line 246Line 250
			return $cache->sql_fetchrow($query_id);
}


			return $cache->sql_fetchrow($query_id);
}


		if ($query_id !== false && $query_id !== null)

		if ($query_id)

		{

		{

			$result = @mysqli_fetch_assoc($query_id);

			$result = mysqli_fetch_assoc($query_id);

			return $result !== null ? $result : false;
}


			return $result !== null ? $result : false;
}


Line 272Line 276
			return $cache->sql_rowseek($rownum, $query_id);
}


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


		return ($query_id !== false) ? @mysqli_data_seek($query_id, $rownum) : false;

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

	}

/**

	}

/**

Line 300Line 304
			return $cache->sql_freeresult($query_id);
}


			return $cache->sql_freeresult($query_id);
}


		return @mysqli_free_result($query_id);











		if (!$query_id)
{
return false;
}

if ($query_id === true)
{
return true;
}

return mysqli_free_result($query_id);

	}

/**

	}

/**

Line 399Line 413

if ($result = @mysqli_query($this->db_connect_id, "EXPLAIN $explain_query"))
{


if ($result = @mysqli_query($this->db_connect_id, "EXPLAIN $explain_query"))
{

						while ($row = @mysqli_fetch_assoc($result))

						while ($row = mysqli_fetch_assoc($result))

						{
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
}

						{
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
}

 
						mysqli_free_result($result);

					}

					}

					@mysqli_free_result($result);

 

if ($html_table)
{


if ($html_table)
{

Line 419Line 433
						if ($result = @mysqli_query($this->db_connect_id, 'SHOW PROFILE ALL;'))
{
$this->html_hold .= '<br />';

						if ($result = @mysqli_query($this->db_connect_id, 'SHOW PROFILE ALL;'))
{
$this->html_hold .= '<br />';

							while ($row = @mysqli_fetch_assoc($result))

							while ($row = mysqli_fetch_assoc($result))

							{
// make <unknown> HTML safe
if (!empty($row['Source_function']))

							{
// make <unknown> HTML safe
if (!empty($row['Source_function']))

Line 437Line 451
								}
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
}

								}
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
}

 
							mysqli_free_result($result);

						}

						}

						@mysqli_free_result($result);

 

if ($html_table)
{


if ($html_table)
{

Line 456Line 470
				$endtime = $endtime[0] + $endtime[1];

$result = @mysqli_query($this->db_connect_id, $query);

				$endtime = $endtime[0] + $endtime[1];

$result = @mysqli_query($this->db_connect_id, $query);

				if ($result !== null)

				if ($result)

				{

				{

					while ($void = @mysqli_fetch_assoc($result))

					while ($void = mysqli_fetch_assoc($result))

					{
// Take the time spent on parsing rows into account
}

					{
// Take the time spent on parsing rows into account
}

 
					mysqli_free_result($result);

				}

				}

				@mysqli_free_result($result);

 

$splittime = explode(' ', microtime());
$splittime = $splittime[0] + $splittime[1];


$splittime = explode(' ', microtime());
$splittime = $splittime[0] + $splittime[1];