phpBB

Code Changes

File: includes/db/mssqlnative.php

  Unmodified   Added   Modified   Removed
Line 199Line 199
	var $m_insert_id = NULL;
var $last_query_text = '';
var $query_options = array();

	var $m_insert_id = NULL;
var $last_query_text = '';
var $query_options = array();

 
	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)
{

		# Test for driver support, to avoid suppressed fatal error

		// Test for driver support, to avoid suppressed fatal error

		if (!function_exists('sqlsrv_connect'))
{

		if (!function_exists('sqlsrv_connect'))
{

			trigger_error('Native MS SQL Server driver for PHP is missing or needs to be updated. Version 1.1 or later is required to install phpBB3. You can download the driver from: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx\n', E_USER_ERROR);


			$this->connect_error = 'Native MS SQL Server driver for PHP is missing or needs to be updated. Version 1.1 or later is required to install phpBB3. You can download the driver from: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx';
return $this->sql_error('');

		}

//set up connection variables

		}

//set up connection variables

Line 219Line 221
		$this->server = $sqlserver . (($port) ? $port_delimiter . $port : '');

//connect to database

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

//connect to database

		error_reporting(E_ALL);

 
		$this->db_connect_id = sqlsrv_connect($this->server, array(
'Database' => $this->dbname,
'UID' => $this->user,

		$this->db_connect_id = sqlsrv_connect($this->server, array(
'Database' => $this->dbname,
'UID' => $this->user,

Line 436Line 437
				unset($row['line2'], $row['line3']);
}
}

				unset($row['line2'], $row['line3']);
}
}

		return $row;
}

/**
* Seek to given row number
* rownum is zero-based
*/
function sql_rowseek($rownum, &$query_id)
{
global $cache;

if (isset($cache->sql_rowset[$query_id]))
{
return $cache->sql_rowseek($rownum, $query_id);
}

$seek = new result_mssqlnative($query_id);
$row = $seek->seek($rownum);
return ($row = $seek->fetch()) ? $row : false;

		return (sizeof($row)) ? $row : false;



















	}

/**

	}

/**

Line 508Line 491
	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 524Line 515
	* @access private
*/
function _sql_error()

	* @access private
*/
function _sql_error()

 
	{
if (function_exists('sqlsrv_errors'))

	{
$errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS);
$error_message = '';

	{
$errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS);
$error_message = '';

Line 533Line 526
		{
foreach ($errors as $error)
{

		{
foreach ($errors as $error)
{

				$error_message .= "SQLSTATE: ".$error[ 'SQLSTATE']."\n";
$error_message .= "code: ".$error[ 'code']."\n";

					$error_message .= "SQLSTATE: " . $error[ 'SQLSTATE'] . "\n";
$error_message .= "code: " . $error[ 'code'] . "\n";

				$code = $error['code'];

				$code = $error['code'];

				$error_message .= "message: ".$error[ 'message']."\n";

					$error_message .= "message: " . $error[ 'message'] . "\n";

			}
$this->last_error_result = $error_message;
$error = $this->last_error_result;

			}
$this->last_error_result = $error_message;
$error = $this->last_error_result;

Line 546Line 539
			$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array();
}


			$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array();
}


		return array(

			$error = array(

			'message'	=> $error,
'code' => $code,
);

			'message'	=> $error,
'code' => $code,
);

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

return $error;

	}

/**

	}

/**