1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

- and my second attempt

git-svn-id: file:///svn/phpbb/trunk@5109 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2005-03-21 23:10:11 +00:00
parent a4e51c9699
commit e4fe2d853d
24 changed files with 253 additions and 428 deletions

View File

@@ -32,11 +32,10 @@ class sql_db
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver . (($port) ? ':' . $port : '');
$this->dbname = $database;
$this->db_connect_id = ($this->persistency) ? @ibase_pconnect($this->server . ':' . $this->dbname, $this->user, $this->password, false, false, 3) : @ibase_connect($this->server . ':' . $this->dbname, $this->user, $this->password, false, false, 3);
$this->db_connect_id = ($this->persistency) ? @ibase_pconnect($this->server . ':' . $this->dbname, $this->user, $sqlpassword, false, false, 3) : @ibase_connect($this->server . ':' . $this->dbname, $this->user, $sqlpassword, false, false, 3);
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
}

View File

@@ -36,11 +36,10 @@ class sql_db
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver . (($port) ? ':' . $port : '');
$this->dbname = $database;
$this->db_connect_id = ($this->persistency) ? @odbc_pconnect($this->server, $this->user, $this->password) : @odbc_connect($this->server, $this->user, $this->password);
$this->db_connect_id = ($this->persistency) ? @odbc_pconnect($this->server, $this->user, $sqlpassword) : @odbc_connect($this->server, $this->user, $sqlpassword);
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
}

View File

@@ -19,7 +19,7 @@
*
***************************************************************************/
if(!defined("SQL_LAYER"))
if (!defined("SQL_LAYER"))
{
define("SQL_LAYER","mssql");
@@ -44,15 +44,14 @@ class sql_db
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$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, $sqlpassword) : @mssql_connect($this->server, $this->user, $sqlpassword);
if($this->db_connect_id && $this->dbname != '')
if ($this->db_connect_id && $this->dbname != '')
{
if(!@mssql_select_db($this->dbname, $this->db_connect_id))
if (!@mssql_select_db($this->dbname, $this->db_connect_id))
{
@mssql_close($this->db_connect_id);
return false;
@@ -77,12 +76,12 @@ class sql_db
//
function sql_close()
{
if($this->db_connect_id)
if ($this->db_connect_id)
{
//
// Commit any remaining transactions
//
if($this->in_transaction)
if ($this->in_transaction)
{
@mssql_query("COMMIT", $this->db_connect_id);
}
@@ -132,11 +131,11 @@ 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];
if(!empty($limits[2]))
if (!empty($limits[2]))
{
$row_offset = ($limits[4]) ? $limits[3] : "";
$num_rows = ($limits[4]) ? $limits[4] : $limits[3];
@@ -146,26 +145,26 @@ class sql_db
$this->result = mssql_query("SELECT $query", $this->db_connect_id);
if($this->result)
if ($this->result)
{
$this->limit_offset[$this->result] = (!empty($row_offset)) ? $row_offset : 0;
if($row_offset > 0)
if ($row_offset > 0)
{
mssql_data_seek($this->result, $row_offset);
}
}
}
else if(eregi("^INSERT ", $query))
else if (eregi("^INSERT ", $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);
if($result_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'];
@@ -175,14 +174,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);
if($result_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'];
}
@@ -190,9 +189,9 @@ class sql_db
}
}
if(!$this->result)
if (!$this->result)
{
if($this->in_transaction)
if ($this->in_transaction)
{
mssql_query("ROLLBACK", $this->db_connect_id);
$this->in_transaction = FALSE;
@@ -201,11 +200,11 @@ class sql_db
return false;
}
if($transaction == END_TRANSACTION && $this->in_transaction)
if ($transaction == END_TRANSACTION && $this->in_transaction)
{
$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;
@@ -216,11 +215,11 @@ class sql_db
}
else
{
if($transaction == END_TRANSACTION && $this->in_transaction )
if ($transaction == END_TRANSACTION && $this->in_transaction)
{
$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;
@@ -236,12 +235,12 @@ class sql_db
//
function sql_numrows($query_id = 0)
{
if(!$query_id)
if (!$query_id)
{
$query_id = $this->result;
}
if($query_id)
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);
}
@@ -253,7 +252,7 @@ class sql_db
function sql_numfields($query_id = 0)
{
if(!$query_id)
if (!$query_id)
{
$query_id = $this->result;
}
@@ -263,7 +262,7 @@ class sql_db
function sql_fieldname($offset, $query_id = 0)
{
if(!$query_id)
if (!$query_id)
{
$query_id = $this->result;
}
@@ -273,7 +272,7 @@ class sql_db
function sql_fieldtype($offset, $query_id = 0)
{
if(!$query_id)
if (!$query_id)
{
$query_id = $this->result;
}
@@ -283,18 +282,18 @@ class sql_db
function sql_fetchrow($query_id = 0)
{
if(!$query_id)
if (!$query_id)
{
$query_id = $this->result;
}
if($query_id)
if ($query_id)
{
empty($row);
$row = mssql_fetch_array($query_id);
while(list($key, $value) = @each($row))
foreach ($row as $key => $value)
{
$row[$key] = stripslashes($value);
}
@@ -309,19 +308,19 @@ class sql_db
function sql_fetchrowset($query_id = 0)
{
if(!$query_id)
if (!$query_id)
{
$query_id = $this->result;
}
if($query_id)
if ($query_id)
{
$i = 0;
empty($rowset);
$rowset = array();
while($row = mssql_fetch_array($query_id))
while ($row = mssql_fetch_array($query_id))
{
while(list($key, $value) = @each($row))
foreach ($row as $key => $value)
{
$rowset[$i][$key] = stripslashes($value);
}
@@ -338,16 +337,16 @@ class sql_db
function sql_fetchfield($field, $row = -1, $query_id)
{
if(!$query_id)
if (!$query_id)
{
$query_id = $this->result;
}
if($query_id)
if ($query_id)
{
if($row != -1)
if ($row != -1)
{
if($this->limit_offset[$query_id] > 0)
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;
}
@@ -358,7 +357,7 @@ class sql_db
}
else
{
if(empty($this->row[$query_id]))
if (empty($this->row[$query_id]))
{
$this->row[$query_id] = mssql_fetch_array($query_id);
$result = stripslashes($this->row[$query_id][$field]);
@@ -375,12 +374,12 @@ class sql_db
function sql_rowseek($rownum, $query_id = 0)
{
if(!$query_id)
if (!$query_id)
{
$query_id = $this->result;
}
if($query_id)
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);
}
@@ -402,7 +401,7 @@ class sql_db
function sql_freeresult($query_id = 0)
{
if(!$query_id)
if (!$query_id)
{
$query_id = $this->result;
}

View File

@@ -30,11 +30,10 @@ class sql_db
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver . (($port) ? ':' . $port : '');
$this->dbname = $database;
$this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $this->password) : @mysql_connect($this->server, $this->user, $this->password);
$this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword) : @mysql_connect($this->server, $this->user, $sqlpassword);
if ($this->db_connect_id && $this->dbname != '')
{

View File

@@ -32,11 +32,10 @@ class sql_db
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver . (($port) ? ':' . $port : '');
$this->dbname = $database;
$this->db_connect_id = ($this->persistency) ? @mysqli_pconnect($this->server, $this->user, $this->password) : @mysqli_connect($this->server, $this->user, $this->password);
$this->db_connect_id = ($this->persistency) ? @mysqli_pconnect($this->server, $this->user, $sqlpassword) : @mysqli_connect($this->server, $this->user, $sqlpassword);
if ($this->db_connect_id && $this->dbname != '')
{

View File

@@ -268,7 +268,7 @@ class sql_db
unset($this->row[$query_id]);
$this->rownum[$query_id] = 0;
while($this->rowset = @pg_fetch_array($query_id, $this->rownum[$query_id], PGSQL_ASSOC))
while ($this->rowset = @pg_fetch_array($query_id, $this->rownum[$query_id], PGSQL_ASSOC))
{
$result[] = $this->rowset;
$this->rownum[$query_id]++;

View File

@@ -39,7 +39,6 @@ class sql_db
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver . (($port) ? ':' . $port : '');
$this->dbname = $database;
@@ -301,15 +300,16 @@ class sql_db
function sql_fetchrowset($query_id = 0)
{
if(!$query_id)
if (!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
if ($query_id)
{
unset($this->rowset[$query_id]);
unset($this->row[$query_id]);
while($this->rowset[$query_id] = @sqlite_fetch_array($query_id, @sqlite_ASSOC))
while ($this->rowset[$query_id] = @sqlite_fetch_array($query_id, @sqlite_ASSOC))
{
$result[] = $this->rowset[$query_id];
}
@@ -323,12 +323,12 @@ class sql_db
function sql_fetchfield($field, $rownum = -1, $query_id = 0)
{
if(!$query_id)
if (!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
if ($query_id)
{
return ($rownum > -1) ? ((@sqlite_seek($query_id, $rownum)) ? @sqlite_column($query_id, $field) : false) : @sqlite_column($query_id, $field);
}