From 57a5147d5b433ad0de1480a003c29676e4986917 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Wed, 19 Mar 2003 21:00:01 +0000 Subject: [PATCH] Wrong syntax for limit, cockup in sql_escape ... git-svn-id: file:///svn/phpbb/trunk@3681 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/firebird.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php index 19d2e47c8c..9309a7dfab 100644 --- a/phpBB/includes/db/firebird.php +++ b/phpBB/includes/db/firebird.php @@ -188,6 +188,8 @@ class sql_db $this->open_queries[] = $this->query_result; } + $this->last_query_text[$this->query_result] = $query; + if (!empty($cache_result)) { $cache->sql_save($query, $this->query_result); @@ -209,7 +211,7 @@ class sql_db $this->query_result = false; $this->num_queries++; - $query .= ' ROWS ' . $total .((!empty($offset)) ? ' TO ' . $offset : ''); + echo $query = 'SELECT FIRST ' . $total .((!empty($offset)) ? ' SKIP ' . $offset : '') . substr($query, 6); return $this->sql_query($query, $expire_time); } @@ -387,9 +389,9 @@ class sql_db function sql_nextid() { - if ($this->query_result) + if ($this->query_result && preg_match('#^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)#is', $this->last_query_text[$query_id], $tablename)) { - $query = "SELECT Gen_ID('" . $tablename[1] . "_id_seq',1) AS last_value + $query = "SELECT GEN_ID('" . $tablename[1] . "_gen', 0) AS new_id FROM RDB\$DATABASE"; if (!($temp_q_id = @ibase_query($this->db_connect_id, $query))) { @@ -415,7 +417,7 @@ class sql_db function sql_escape($msg) { - return (@ini_get('magic_quotes_sybase') || strtoupper(@ini_get('magic_quotes_sybase')) == 'ON') ? str_replace($replace_min('match'), $replace_min('replace'), $msg) : str_replace($replace_max('match'), $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'], $msg) : str_replace($this->replace_max['match'], $this->replace_max['replace'], $msg); } function sql_error($sql = '')