phpBB

Code Changes

File: includes/db/mssql.php

  Unmodified   Added   Modified   Removed
Line 25Line 25
*/
class dbal_mssql extends dbal
{

*/
class dbal_mssql extends dbal
{

 
	var $connect_error = '';


	/**
* Connect to server
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{

	/**
* Connect to server
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{

 
		if (!function_exists('mssql_connect'))
{
$this->connect_error = 'mssql_connect function does not exist, is mssql extension installed?';
return $this->sql_error('');
}


		$this->persistency = $persistency;
$this->user = $sqluser;
$this->dbname = $database;

		$this->persistency = $persistency;
$this->user = $sqluser;
$this->dbname = $database;

Line 65Line 73
	/**
* Version information about used database
* @param bool $raw if true, only return the fetched sql_server_version

	/**
* Version information about used database
* @param bool $raw if true, only return the fetched sql_server_version

 
	* @param bool $use_cache If true, it is safe to retrieve the value from the cache

	* @return string sql server version
*/

	* @return string sql server version
*/

	function sql_server_info($raw = false)

	function sql_server_info($raw = false, $use_cache = true)

	{
global $cache;


	{
global $cache;


		if (empty($cache) || ($this->sql_server_version = $cache->get('mssql_version')) === false)

		if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mssql_version')) === false)

		{
$result_id = @mssql_query("SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY('productlevel'), SERVERPROPERTY('edition')", $this->db_connect_id);


		{
$result_id = @mssql_query("SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY('productlevel'), SERVERPROPERTY('edition')", $this->db_connect_id);


Line 84Line 93

$this->sql_server_version = ($row) ? trim(implode(' ', $row)) : 0;



$this->sql_server_version = ($row) ? trim(implode(' ', $row)) : 0;


			if (!empty($cache))

			if (!empty($cache) && $use_cache)

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

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

Line 329Line 338
	function sql_escape($msg)
{
return str_replace(array("'", "\0"), array("''", ''), $msg);

	function sql_escape($msg)
{
return str_replace(array("'", "\0"), array("''", ''), $msg);

 
	}

/**
* {@inheritDoc}
*/
function sql_lower_text($column_name)
{
return "LOWER(SUBSTRING($column_name, 1, DATALENGTH($column_name)))";

	}

/**

	}

/**

Line 345Line 362
	* @access private
*/
function _sql_error()

	* @access private
*/
function _sql_error()

 
	{
if (function_exists('mssql_get_last_message'))

	{
$error = array(
'message' => @mssql_get_last_message(),

	{
$error = array(
'message' => @mssql_get_last_message(),

			'code'		=> ''

				'code'		=> '',

		);

// Get error code number

		);

// Get error code number

Line 374Line 393
				$error['message'] .= '<br />' . $row['message'];
}
@mssql_free_result($result_id);

				$error['message'] .= '<br />' . $row['message'];
}
@mssql_free_result($result_id);

 
			}
}
else
{
$error = array(
'message' => $this->connect_error,
'code' => '',
);

		}

return $error;

		}

return $error;