|
From: Paul S. O. <ps...@us...> - 2001-11-20 22:34:52
|
Update of /cvsroot/phpbb/phpBB2/db
In directory usw-pr-cvs1:/tmp/cvs-serv28539
Modified Files:
mssql.php
Log Message:
Some updates, uses TOP rather than two ROWCOUNT queries for LIMIT
Index: mssql.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/db/mssql.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** mssql.php 2001/11/09 13:42:31 1.17
--- mssql.php 2001/11/20 22:34:50 1.18
***************
*** 89,93 ****
if( $this->in_transaction )
{
! mssql_query("COMMIT", $this->db_connect_id);
}
$result = @mssql_close($this->db_connect_id);
--- 89,93 ----
if( $this->in_transaction )
{
! @mssql_query("COMMIT", $this->db_connect_id);
}
$result = @mssql_close($this->db_connect_id);
***************
*** 117,121 ****
if($transaction == BEGIN_TRANSACTION)
{
! $result = mssql_query("BEGIN TRANSACTION", $this->db_connect_id);
if(!$result)
{
--- 117,121 ----
if($transaction == BEGIN_TRANSACTION)
{
! $result = @mssql_query("BEGIN TRANSACTION", $this->db_connect_id);
if(!$result)
{
***************
*** 137,143 ****
// ... needs checking under Windows itself.
//
! if(eregi("LIMIT", $query))
{
! preg_match("/^(.*)LIMIT ([0-9]+)[, ]*([0-9]+)*/s", $query, $limits);
$query = $limits[1];
--- 137,143 ----
// ... needs checking under Windows itself.
//
! if( preg_match("/^SELECT.*?LIMIT/is", $query) )
{
! preg_match("/^SELECT(.*)LIMIT ([0-9]+)[, ]*([0-9]+)*$/s", $query, $limits);
$query = $limits[1];
***************
*** 153,163 ****
}
! // $this->query_array[] = $query;
! @mssql_query("SET ROWCOUNT ".($row_offset + $num_rows));
!
$this->query_result = @mssql_query($query, $this->db_connect_id);
!
! @mssql_query("SET ROWCOUNT 0");
$this->query_limit_success[$this->query_result] = true;
--- 153,161 ----
}
! $query = "SELECT TOP " . ($row_offset + $num_rows) . $query;
! // @mssql_query("SET ROWCOUNT ".($row_offset + $num_rows));
$this->query_result = @mssql_query($query, $this->db_connect_id);
! // @mssql_query("SET ROWCOUNT 0");
$this->query_limit_success[$this->query_result] = true;
***************
*** 178,183 ****
else if(eregi("^INSERT ", $query))
{
- // $this->query_array[] = $query;
-
$query = preg_replace("/\\\'/s", "''", $query);
--- 176,179 ----
***************
*** 193,197 ****
if($this->in_transaction)
{
! mssql_query("ROLLBACK", $this->db_connect_id);
$this->in_transaction = FALSE;
}
--- 189,193 ----
if($this->in_transaction)
{
! @mssql_query("ROLLBACK", $this->db_connect_id);
$this->in_transaction = FALSE;
}
***************
*** 204,209 ****
else
{
- // $this->query_array[] = $query;
-
if(eregi("SELECT", $query))
{
--- 200,203 ----
***************
*** 234,238 ****
if($this->in_transaction)
{
! mssql_query("ROLLBACK", $this->db_connect_id);
$this->in_transaction = FALSE;
}
--- 228,232 ----
if($this->in_transaction)
{
! @mssql_query("ROLLBACK", $this->db_connect_id);
$this->in_transaction = FALSE;
}
***************
*** 241,247 ****
}
! if($transaction == END_TRANSACTION)
{
! $result = mssql_query("COMMIT", $this->db_connect_id);
$this->in_transaction = FALSE;
}
--- 235,241 ----
}
! if($transaction == END_TRANSACTION && $this->in_transaction)
{
! $result = @mssql_query("COMMIT", $this->db_connect_id);
$this->in_transaction = FALSE;
}
***************
*** 253,257 ****
if($transaction == END_TRANSACTION)
{
! $result = mssql_query("COMMIT", $this->db_connect_id);
$this->in_transaction = FALSE;
}
--- 247,251 ----
if($transaction == END_TRANSACTION)
{
! $result = @mssql_query("COMMIT", $this->db_connect_id);
$this->in_transaction = FALSE;
}
|