1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-07 17:27:16 +02:00

Yep, more fixes

git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3221 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen
2002-12-21 18:31:54 +00:00
parent 3a07d77b03
commit 6f9d59a4a6
11 changed files with 67 additions and 41 deletions

View File

@@ -51,7 +51,7 @@ class sql_db
$this->server = $sqlserver;
$this->dbname = $database;
$this->db_connect_id = ( $this->persistency ) ? mssql_pconnect($this->server, $this->user, $this->password) : mssql_connect($this->server, $this->user, $this->password);
$this->db_connect_id = ( $this->persistency ) ? @mssql_pconnect($this->server, $this->user, $this->password) : @mssql_connect($this->server, $this->user, $this->password);
if( $this->db_connect_id && $this->dbname != "" )
{
@@ -92,7 +92,7 @@ class sql_db
//
// Query method
//
function sql_query($query = "", $transaction = FALSE)
function sql_query($query = '', $transaction = FALSE)
{
//
// Remove any pre-existing queries
@@ -100,13 +100,13 @@ class sql_db
unset($this->result);
unset($this->row);
if ( $query != "" )
if ( $query != '' )
{
$this->num_queries++;
if ( $transaction == BEGIN_TRANSACTION && !$this->in_transaction )
{
if ( !mssql_query("BEGIN TRANSACTION", $this->db_connect_id) )
if ( !@mssql_query('BEGIN TRANSACTION', $this->db_connect_id) )
{
return false;
}
@@ -125,7 +125,7 @@ class sql_db
// returns something then there's a problem. This may well be a false assumption though
// ... needs checking under Windows itself.
//
if( preg_match("/^SELECT(.*?)(LIMIT ([0-9]+)[, ]*([0-9]+)*)?$/s", $query, $limits) )
if( preg_match('#^SELECT(.*?)(LIMIT ([0-9]+)[, ]*([0-9]+)*)?$#s', $query, $limits) )
{
$query = $limits[1];
@@ -134,10 +134,10 @@ class sql_db
$row_offset = ( $limits[4] ) ? $limits[3] : "";
$num_rows = ( $limits[4] ) ? $limits[4] : $limits[3];
$query = "TOP " . ( $row_offset + $num_rows ) . $query;
$query = 'TOP ' . ( $row_offset + $num_rows ) . $query;
}
$this->result = mssql_query("SELECT $query", $this->db_connect_id);
$this->result = @mssql_query("SELECT $query", $this->db_connect_id);
if( $this->result )
{
@@ -145,20 +145,20 @@ class sql_db
if( $row_offset > 0 )
{
mssql_data_seek($this->result, $row_offset);
@mssql_data_seek($this->result, $row_offset);
}
}
}
else if( eregi("^INSERT ", $query) )
else if( preg_match('#^INSERT #i', $query) )
{
if( mssql_query($query, $this->db_connect_id) )
if( @mssql_query($query, $this->db_connect_id) )
{
$this->result = time() + microtime();
$result_id = mssql_query("SELECT @@IDENTITY AS id, @@ROWCOUNT as affected", $this->db_connect_id);
$result_id = @mssql_query('SELECT @@IDENTITY AS id, @@ROWCOUNT as affected', $this->db_connect_id);
if( $result_id )
{
if( $row = mssql_fetch_array($result_id) )
if( $row = @mssql_fetch_array($result_id) )
{
$this->next_id[$this->db_connect_id] = $row['id'];
$this->affected_rows[$this->db_connect_id] = $row['affected'];
@@ -168,14 +168,14 @@ class sql_db
}
else
{
if( mssql_query($query, $this->db_connect_id) )
if( @mssql_query($query, $this->db_connect_id) )
{
$this->result = time() + microtime();
$result_id = mssql_query("SELECT @@ROWCOUNT as affected", $this->db_connect_id);
$result_id = @mssql_query('SELECT @@ROWCOUNT as affected', $this->db_connect_id);
if( $result_id )
{
if( $row = mssql_fetch_array($result_id) )
if( $row = @mssql_fetch_array($result_id) )
{
$this->affected_rows[$this->db_connect_id] = $row['affected'];
}
@@ -187,7 +187,7 @@ class sql_db
{
if( $this->in_transaction )
{
mssql_query("ROLLBACK", $this->db_connect_id);
@mssql_query('ROLLBACK', $this->db_connect_id);
$this->in_transaction = FALSE;
}
@@ -198,7 +198,7 @@ class sql_db
{
$this->in_transaction = FALSE;
if( !@mssql_query("COMMIT", $this->db_connect_id) )
if( !@mssql_query('COMMIT', $this->db_connect_id) )
{
@mssql_query("ROLLBACK", $this->db_connect_id);
return false;
@@ -213,9 +213,9 @@ class sql_db
{
$this->in_transaction = FALSE;
if( !@mssql_query("COMMIT", $this->db_connect_id) )
if( !@mssql_query('COMMIT', $this->db_connect_id) )
{
@mssql_query("ROLLBACK", $this->db_connect_id);
@mssql_query('ROLLBACK', $this->db_connect_id);
return false;
}
}
@@ -236,7 +236,7 @@ class sql_db
if( $query_id )
{
return ( !empty($this->limit_offset[$query_id]) ) ? mssql_num_rows($query_id) - $this->limit_offset[$query_id] : @mssql_num_rows($query_id);
return ( !empty($this->limit_offset[$query_id]) ) ? @mssql_num_rows($query_id) - $this->limit_offset[$query_id] : @mssql_num_rows($query_id);
}
else
{
@@ -251,7 +251,7 @@ class sql_db
$query_id = $this->result;
}
return ( $query_id ) ? mssql_num_fields($query_id) : false;
return ( $query_id ) ? @mssql_num_fields($query_id) : false;
}
function sql_fieldname($offset, $query_id = 0)
@@ -261,7 +261,7 @@ class sql_db
$query_id = $this->result;
}
return ( $query_id ) ? mssql_field_name($query_id, $offset) : false;
return ( $query_id ) ? @mssql_field_name($query_id, $offset) : false;
}
function sql_fieldtype($offset, $query_id = 0)
@@ -271,7 +271,7 @@ class sql_db
$query_id = $this->result;
}
return ( $query_id ) ? mssql_field_type($query_id, $offset) : false;
return ( $query_id ) ? @mssql_field_type($query_id, $offset) : false;
}
function sql_fetchrow($query_id = 0)
@@ -285,7 +285,7 @@ class sql_db
{
empty($row);
$row = mssql_fetch_array($query_id);
$row = @mssql_fetch_array($query_id);
while( list($key, $value) = @each($row) )
{
@@ -313,7 +313,7 @@ class sql_db
$i = 0;
empty($rowset);
while( $row = mssql_fetch_array($query_id))
while( $row = @mssql_fetch_array($query_id))
{
while( list($key, $value) = @each($row) )
{
@@ -344,18 +344,18 @@ class sql_db
{
if( $this->limit_offset[$query_id] > 0 )
{
$result = ( !empty($this->limit_offset[$query_id]) ) ? mssql_result($this->result, ($this->limit_offset[$query_id] + $row), $field) : false;
$result = ( !empty($this->limit_offset[$query_id]) ) ? @mssql_result($this->result, ($this->limit_offset[$query_id] + $row), $field) : false;
}
else
{
$result = mssql_result($this->result, $row, $field);
$result = @mssql_result($this->result, $row, $field);
}
}
else
{
if( empty($this->row[$query_id]) )
{
$this->row[$query_id] = mssql_fetch_array($query_id);
$this->row[$query_id] = @mssql_fetch_array($query_id);
$result = stripslashes($this->row[$query_id][$field]);
}
}
@@ -377,7 +377,7 @@ class sql_db
if( $query_id )
{
return ( !empty($this->limit_offset[$query_id]) ) ? mssql_data_seek($query_id, ($this->limit_offset[$query_id] + $rownum)) : mssql_data_seek($query_id, $rownum);
return ( !empty($this->limit_offset[$query_id]) ) ? @mssql_data_seek($query_id, ($this->limit_offset[$query_id] + $rownum)) : @mssql_data_seek($query_id, $rownum);
}
else
{
@@ -402,7 +402,7 @@ class sql_db
$query_id = $this->result;
}
return ( $query_id ) ? mssql_free_result($query_id) : false;
return ( $query_id ) ? @mssql_free_result($query_id) : false;
}
function sql_error($query_id = 0)