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->persistency = $persistency;
$this->user = $sqluser;

		$this->server = $sqlserver . (($port) ? ':' . $port : '');

 
		$this->dbname = $database;

		$this->dbname = $database;

 

$port_delimiter = (defined('PHP_OS') && substr(PHP_OS, 0, 3) === 'WIN') ? ',' : ':';
$this->server = $sqlserver . (($port) ? $port_delimiter . $port : '');


@ini_set('mssql.charset', 'UTF-8');
@ini_set('mssql.textlimit', 2147483647);


@ini_set('mssql.charset', 'UTF-8');
@ini_set('mssql.textlimit', 2147483647);

Line 62Line 72

/**
* Version information about used database


/**
* 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

	*/

	*/

	function sql_server_info()





	function sql_server_info($raw = false, $use_cache = true)
{
global $cache;

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 74Line 91
			@mssql_free_result($result_id);
}


			@mssql_free_result($result_id);
}


		if ($row)









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

if (!empty($cache) && $use_cache)
{
$cache->put('mssql_version', $this->sql_server_version);
}
}

if ($raw)

		{

		{

			return 'MSSQL<br />' . implode(' ', $row);

			return $this->sql_server_version;

		}


		}


		return 'MSSQL';

		return ($this->sql_server_version) ? 'MSSQL<br />' . $this->sql_server_version : 'MSSQL';

	}

/**

	}

/**

Line 162Line 187
			return false;
}


			return false;
}


		return ($this->query_result) ? $this->query_result : false;

		return $this->query_result;

	}

/**

	}

/**

Line 312Line 337
	*/
function sql_escape($msg)
{

	*/
function sql_escape($msg)
{

		return str_replace("'", "''", $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 329Line 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 358Line 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;