And from the flames rose the might phoenix ... well, a little crisp around the edges with the odd missing feather ...

git-svn-id: file:///svn/phpbb/trunk@3688 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-03-20 01:32:57 +00:00
parent 229242acf5
commit 115a2cc9e0
2 changed files with 30 additions and 29 deletions

View file

@ -32,8 +32,8 @@ class sql_db
var $transaction = false; var $transaction = false;
var $sql_report = ''; var $sql_report = '';
var $sql_time = 0; var $sql_time = 0;
var $escape_max = array('match' => array('\\', '\'', '"'), 'replace' => array('\\\\', '\'\'', '\"')); var $escape_max = array('match' => array("\0", '\\', '\'', '"'), 'replace' => array('\\0', '\\\\', '\'\'', '\"'));
var $escape_min = array('match' => array('\\', '"'), 'replace' => array('\\\\', '\"')); var $escape_min = array('match' => array("\0", '\\', '"'), 'replace' => array('\\0', '\\\\', '\"'));
// Constructor // Constructor
function sql_db($sqlserver, $sqluser, $sqlpassword, $database = '', $port = '', $persistency = false) function sql_db($sqlserver, $sqluser, $sqlpassword, $database = '', $port = '', $persistency = false)
@ -46,7 +46,7 @@ class sql_db
$this->password = $sqlpassword; $this->password = $sqlpassword;
$this->server = $sqlserver; $this->server = $sqlserver;
$this->db_connect_id =($this->persistency) ? @ibase_pconnect($this->server, $this->user, $this->password) : @ibase_connect($this->server, $this->user, $this->password); $this->db_connect_id =($this->persistency) ? ibase_pconnect($this->server, $this->user, $this->password) : ibase_connect($this->server, $this->user, $this->password);
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
} }
@ -130,16 +130,11 @@ class sql_db
$curtime = $curtime[0] + $curtime[1] - $starttime; $curtime = $curtime[0] + $curtime[1] - $starttime;
} }
if (!($this->query_result = @ibase_query($query, $this->db_connect_id))) if (($this->query_result = ibase_query($query, $this->db_connect_id)) === FALSE)
{ {
$this->sql_error($query); $this->sql_error($query);
} }
if (!$this->transaction)
{
@ibase_commit();
}
if (!empty($_GET['explain'])) if (!empty($_GET['explain']))
{ {
$endtime = explode(' ', microtime()); $endtime = explode(' ', microtime());
@ -211,7 +206,7 @@ class sql_db
$this->query_result = false; $this->query_result = false;
$this->num_queries++; $this->num_queries++;
echo $query = 'SELECT FIRST ' . $total .((!empty($offset)) ? ' SKIP ' . $offset : '') . substr($query, 6); $query = 'SELECT FIRST ' . $total . ((!empty($offset)) ? ' SKIP ' . $offset : '') . substr($query, 6);
return $this->sql_query($query, $expire_time); return $this->sql_query($query, $expire_time);
} }
@ -302,7 +297,12 @@ class sql_db
return $cache->sql_fetchrow($query_id); return $cache->sql_fetchrow($query_id);
} }
return ($query_id) ? get_object_vars(@ibase_fetch_object($query_id)) : false; $row = array();
foreach (get_object_vars(ibase_fetch_object($query_id, IBASE_TEXT)) as $key => $value)
{
$row[strtolower($key)] = trim(str_replace("\\0", "\0", str_replace("\\n", "\n", $value)));
}
return ($query_id) ? $row : false;
} }
function sql_fetchrowset($query_id = 0) function sql_fetchrowset($query_id = 0)
@ -311,11 +311,12 @@ class sql_db
{ {
$query_id = $this->query_result; $query_id = $this->query_result;
} }
if ($query_id) if ($query_id)
{ {
unset($this->rowset[$query_id]); unset($this->rowset[$query_id]);
unset($this->row[$query_id]); unset($this->row[$query_id]);
while($this->rowset[$query_id] = get_object_vars(@ibase_fetch_object($query_id))) while($this->rowset[$query_id] = get_object_vars(@ibase_fetch_object($query_id, IBASE_TEXT )))
{ {
$result[] = $this->rowset[$query_id]; $result[] = $this->rowset[$query_id];
} }
@ -417,7 +418,7 @@ class sql_db
function sql_escape($msg) function sql_escape($msg)
{ {
return (@ini_get('magic_quotes_sybase') || strtoupper(@ini_get('magic_quotes_sybase')) == 'ON') ? str_replace($this->replace_min['match'], $this->replace_min['replace'], $msg) : str_replace($this->replace_max['match'], $this->replace_max['replace'], $msg); return (@ini_get('magic_quotes_sybase') || strtoupper(@ini_get('magic_quotes_sybase')) == 'ON') ? str_replace($this->replace_min['match'], $this->replace_min['replace'], stripslashes($msg)) : str_replace($this->replace_max['match'], $this->replace_max['replace'], stripslashes($msg));
} }
function sql_error($sql = '') function sql_error($sql = '')

View file

@ -208,12 +208,12 @@ CREATE TABLE phpbb_forums (
forum_last_post_id INTEGER DEFAULT 0 NOT NULL, forum_last_post_id INTEGER DEFAULT 0 NOT NULL,
forum_last_poster_id INTEGER DEFAULT 0 NOT NULL, forum_last_poster_id INTEGER DEFAULT 0 NOT NULL,
forum_last_post_time INTEGER DEFAULT 0 NOT NULL, forum_last_post_time INTEGER DEFAULT 0 NOT NULL,
forum_last_poster_name VARCHAR(30), forum_last_poster_name VARCHAR(30) DEFAULT '' NOT NULL,
display_on_index SMALLINT DEFAULT 1 NOT NULL, display_on_index SMALLINT DEFAULT 1 NOT NULL,
enable_icons SMALLINT DEFAULT 1 NOT NULL, enable_icons SMALLINT DEFAULT 1 NOT NULL,
enable_prune SMALLINT DEFAULT 0 NOT NULL, enable_prune SMALLINT DEFAULT 0 NOT NULL,
prune_next INTEGER, prune_next INTEGER DEFAULT 0 NOT NULL,
prune_days SMALLINT NOT NULL, prune_days SMALLINT DEFAULT 0 NOT NULL,
prune_freq SMALLINT DEFAULT 0 NOT NULL, prune_freq SMALLINT DEFAULT 0 NOT NULL,
PRIMARY KEY (forum_id) PRIMARY KEY (forum_id)
); );
@ -252,13 +252,13 @@ CREATE INDEX phpbb_forums_watch_status ON phpbb_forums_watch (notify_status);
CREATE TABLE phpbb_groups ( CREATE TABLE phpbb_groups (
group_id INTEGER NOT NULL, group_id INTEGER NOT NULL,
group_type SMALLINT DEFAULT 1 NOT NULL, group_type SMALLINT DEFAULT 1 NOT NULL,
group_name VARCHAR(40) NOT NULL, group_name VARCHAR(40) DEFAULT '' NOT NULL,
group_display SMALLINT DEFAULT 0 NOT NULL, group_display SMALLINT DEFAULT 0 NOT NULL,
group_avatar VARCHAR(100), group_avatar VARCHAR(100) DEFAULT '' NOT NULL,
group_avatar_type SMALLINT, group_avatar_type SMALLINT DEFAULT 0 NOT NULL,
group_rank INTEGER DEFAULT 0, group_rank INTEGER DEFAULT 0 NOT NULL,
group_colour VARCHAR(6) DEFAULT '' NOT NULL, group_colour VARCHAR(6) DEFAULT '' NOT NULL,
group_description VARCHAR(255) NOT NULL, group_description VARCHAR(255) DEFAULT '' NOT NULL,
PRIMARY KEY (group_id) PRIMARY KEY (group_id)
); );
@ -462,7 +462,7 @@ CREATE TABLE phpbb_posts (
poster_id INTEGER DEFAULT 0 NOT NULL, poster_id INTEGER DEFAULT 0 NOT NULL,
attach_id INTEGER DEFAULT 0 NOT NULL, attach_id INTEGER DEFAULT 0 NOT NULL,
icon_id SMALLINT DEFAULT 1 NOT NULL, icon_id SMALLINT DEFAULT 1 NOT NULL,
poster_ip VARCHAR(40) NOT NULL, poster_ip VARCHAR(40) DEFAULT '' NOT NULL,
post_time INTEGER DEFAULT 0 NOT NULL, post_time INTEGER DEFAULT 0 NOT NULL,
post_approved SMALLINT DEFAULT 1 NOT NULL, post_approved SMALLINT DEFAULT 1 NOT NULL,
post_reported SMALLINT DEFAULT 0 NOT NULL, post_reported SMALLINT DEFAULT 0 NOT NULL,
@ -471,14 +471,14 @@ CREATE TABLE phpbb_posts (
enable_smilies SMALLINT DEFAULT 1 NOT NULL, enable_smilies SMALLINT DEFAULT 1 NOT NULL,
enable_magic_url SMALLINT DEFAULT 1 NOT NULL, enable_magic_url SMALLINT DEFAULT 1 NOT NULL,
enable_sig SMALLINT DEFAULT 1 NOT NULL, enable_sig SMALLINT DEFAULT 1 NOT NULL,
post_username VARCHAR(30), post_username VARCHAR(30) DEFAULT '',
post_subject VARCHAR(60), post_subject VARCHAR(60) DEFAULT '',
post_text BLOB SUB_TYPE 1, post_text BLOB SUB_TYPE 1 DEFAULT '' NOT NULL,
post_checksum VARCHAR(32) NOT NULL, post_checksum VARCHAR(32) DEFAULT '' NOT NULL,
post_encoding VARCHAR(11) DEFAULT 'iso-8859-15' NOT NULL, post_encoding VARCHAR(11) DEFAULT 'iso-8859-15' NOT NULL,
bbcode_bitfield INTEGER DEFAULT 0 NOT NULL, bbcode_bitfield INTEGER DEFAULT 0 NOT NULL,
bbcode_uid VARCHAR(10) NOT NULL, bbcode_uid VARCHAR(10) DEFAULT '' NOT NULL,
post_edit_time INTEGER, post_edit_time INTEGER DEFAULT 0 NOT NULL,
post_edit_count SMALLINT DEFAULT 0 NOT NULL, post_edit_count SMALLINT DEFAULT 0 NOT NULL,
PRIMARY KEY (post_id) PRIMARY KEY (post_id)
); );
@ -892,7 +892,7 @@ CREATE TABLE phpbb_topics (
topic_last_poster_name VARCHAR(30), topic_last_poster_name VARCHAR(30),
topic_last_post_time INTEGER DEFAULT 0 NOT NULL, topic_last_post_time INTEGER DEFAULT 0 NOT NULL,
topic_moved_id INTEGER DEFAULT 0 NOT NULL, topic_moved_id INTEGER DEFAULT 0 NOT NULL,
poll_title VARCHAR(255) NOT NULL, poll_title VARCHAR(255) DEFAULT '' NOT NULL,
poll_start INTEGER DEFAULT 0 NOT NULL, poll_start INTEGER DEFAULT 0 NOT NULL,
poll_length INTEGER DEFAULT 0 NOT NULL, poll_length INTEGER DEFAULT 0 NOT NULL,
poll_last_vote INTEGER, poll_last_vote INTEGER,