mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Various updates
git-svn-id: file:///svn/phpbb/trunk@297 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
647864f581
commit
8e1f0cf096
2 changed files with 53 additions and 21 deletions
|
@ -4,7 +4,7 @@
|
||||||
* -------------------
|
* -------------------
|
||||||
* begin : Saturday, Feb 13, 2001
|
* begin : Saturday, Feb 13, 2001
|
||||||
* copyright : (C) 2001 The phpBB Group
|
* copyright : (C) 2001 The phpBB Group
|
||||||
* email : support@phpbb.com
|
* email : supportphpbb.com
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
|
@ -64,8 +64,8 @@ class sql_db
|
||||||
if(!$dbselect)
|
if(!$dbselect)
|
||||||
{
|
{
|
||||||
@mssql_close($this->db_connect_id);
|
@mssql_close($this->db_connect_id);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
$this->db_connect_id = $dbselect;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->db_connect_id;
|
return $this->db_connect_id;
|
||||||
|
@ -78,10 +78,6 @@ class sql_db
|
||||||
{
|
{
|
||||||
if($this->db_connect_id)
|
if($this->db_connect_id)
|
||||||
{
|
{
|
||||||
if($this->query_result)
|
|
||||||
{
|
|
||||||
@mssql_free_result($this->query_result);
|
|
||||||
}
|
|
||||||
$result = @mssql_close($this->db_connect_id);
|
$result = @mssql_close($this->db_connect_id);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -111,9 +107,20 @@ class sql_db
|
||||||
// you do will potentially impact performance
|
// you do will potentially impact performance
|
||||||
// compared to an 'in-built' limit
|
// compared to an 'in-built' limit
|
||||||
//
|
//
|
||||||
|
// Another issue is the 'lack' of a returned true
|
||||||
|
// value when a query is valid but has no result
|
||||||
|
// set (as with all the other DB interfaces).
|
||||||
|
// It seems though that it's 'fair' to say that if
|
||||||
|
// a query returns a false result (ie. no resource id)
|
||||||
|
// then the SQL was valid but had no result set. If the
|
||||||
|
// query returns nothing but the rowcount returns
|
||||||
|
// something then there's a problem. This
|
||||||
|
// may well be a false assumption though ... needs
|
||||||
|
// checking under Windows itself.
|
||||||
|
//
|
||||||
if(eregi("LIMIT", $query))
|
if(eregi("LIMIT", $query))
|
||||||
{
|
{
|
||||||
|
"HERE";
|
||||||
preg_match("/^(.*)LIMIT ([0-9]+)[, ]*([0-9]+)*/s", $query, $limits);
|
preg_match("/^(.*)LIMIT ([0-9]+)[, ]*([0-9]+)*/s", $query, $limits);
|
||||||
|
|
||||||
$query = $limits[1];
|
$query = $limits[1];
|
||||||
|
@ -128,6 +135,7 @@ class sql_db
|
||||||
$num_rows = $limits[2];
|
$num_rows = $limits[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"<br>".$query."<br>";
|
||||||
@mssql_query("SET ROWCOUNT ".($row_offset + $num_rows));
|
@mssql_query("SET ROWCOUNT ".($row_offset + $num_rows));
|
||||||
$this->query_result = @mssql_query($query, $this->db_connect_id);
|
$this->query_result = @mssql_query($query, $this->db_connect_id);
|
||||||
@mssql_query("SET ROWCOUNT 0");
|
@mssql_query("SET ROWCOUNT 0");
|
||||||
|
@ -136,7 +144,7 @@ class sql_db
|
||||||
|
|
||||||
$this->query_limit_offset[$this->query_result] = -1;
|
$this->query_limit_offset[$this->query_result] = -1;
|
||||||
$this->query_limit_numrows[$this->query_result] = $num_rows;
|
$this->query_limit_numrows[$this->query_result] = $num_rows;
|
||||||
if($this->query_result && $row_offset>0)
|
if($this->query_result && $row_offset > 0)
|
||||||
{
|
{
|
||||||
$result = @mssql_data_seek($this->query_result, $row_offset);
|
$result = @mssql_data_seek($this->query_result, $row_offset);
|
||||||
if(!$result)
|
if(!$result)
|
||||||
|
@ -150,21 +158,46 @@ class sql_db
|
||||||
{
|
{
|
||||||
$this->query_result = @mssql_query($query, $this->db_connect_id);
|
$this->query_result = @mssql_query($query, $this->db_connect_id);
|
||||||
|
|
||||||
$next_id_query = @mssql_query("SELECT @@IDENTITY AS this_id");
|
if($this->query_result)
|
||||||
$this->next_id[$this->query_result] = $this->sql_fetchfield("this_id", -1, $next_id_query);
|
{
|
||||||
|
$next_id_query = @mssql_query("SELECT @@IDENTITY AS this_id");
|
||||||
|
$this->next_id[$this->query_result] = $this->sql_fetchfield("this_id", -1, $next_id_query);
|
||||||
|
}
|
||||||
$this->query_limit_offset[$this->query_result] = -1;
|
$this->query_limit_offset[$this->query_result] = -1;
|
||||||
$this->query_limit_numrows[$this->query_result] = -1;
|
$this->query_limit_numrows[$this->query_result] = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->query_result = @mssql_query($query, $this->db_connect_id);
|
//
|
||||||
|
// This needs a little more work
|
||||||
$next_id_query = @mssql_query("SELECT @@ROWCOUNT AS this_count");
|
// before we take it public. SELECT needs
|
||||||
$this->affected_rows[$this->query_result] = $this->sql_fetchfield("this_count", -1, $next_id_query);
|
// separating out, with other queries
|
||||||
|
// (UPDATE, DELETE, etc.) having a uniqid
|
||||||
$this->query_limit_offset[$this->query_result] = -1;
|
// $this-
|
||||||
$this->query_limit_numrows[$this->query_result] = -1;
|
//
|
||||||
|
if(eregi("SELECT", $query))
|
||||||
|
{
|
||||||
|
$this->query_result = @@mssql_query($query, $this->db_connect_id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->query_result = @@mssql_query($query, $this->db_connect_id);
|
||||||
|
if($this->query_result)
|
||||||
|
{
|
||||||
|
$this->query_result = uniqid(rand());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($this->query_result)
|
||||||
|
{
|
||||||
|
$affected_query = @mssql_query("SELECT @@ROWCOUNT AS this_count");
|
||||||
|
$this->affected_rows[$this->query_result] = $this->sql_fetchfield("this_count", -1, $affected_query);
|
||||||
|
$this->query_limit_offset[$this->query_result] = -1;
|
||||||
|
$this->query_limit_numrows[$this->query_result] = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->query_result;
|
return $this->query_result;
|
||||||
|
@ -209,7 +242,7 @@ class sql_db
|
||||||
}
|
}
|
||||||
if($query_id)
|
if($query_id)
|
||||||
{
|
{
|
||||||
return $affected_rows[$query_id];
|
return $this->affected_rows[$query_id];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,7 +90,6 @@ function make_jumpbox()
|
||||||
ORDER BY c.cat_order";
|
ORDER BY c.cat_order";
|
||||||
if(!$q_categories = $db->sql_query($sql))
|
if(!$q_categories = $db->sql_query($sql))
|
||||||
{
|
{
|
||||||
$db_error = $db->sql_error();
|
|
||||||
error_die(SQL_QUERY, "Couldn't obtain category list.", __LINE__, __FILE__);
|
error_die(SQL_QUERY, "Couldn't obtain category list.", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue