phpBB

Code Changes

File: includes/db/mssqlnative.php

  Unmodified   Added   Modified   Removed
Line 50Line 50
			}
}


			}
}


		$this->m_row_count = count($this->m_rows);

		$this->m_row_count = sizeof($this->m_rows);

	}

private function array_to_obj($array, &$obj)

	}

private function array_to_obj($array, &$obj)

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 256Line 257
		}

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

		}

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

 
	}

/**
* {@inheritDoc}
*/
function sql_buffer_nested_transactions()
{
return true;

	}

/**

	}

/**

Line 388Line 397
	*/
function sql_affectedrows()
{

	*/
function sql_affectedrows()
{

		return ($this->db_connect_id) ? @sqlsrv_rows_affected($this->db_connect_id) : false;

		return (!empty($this->query_result)) ? @sqlsrv_rows_affected($this->query_result) : false;

	}

/**

	}

/**

Line 428Line 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 500Line 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 516Line 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 525Line 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 538Line 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;

	}

/**

	}

/**