aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/db/postgres7.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2001-05-14 14:23:29 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2001-05-14 14:23:29 +0000
commit60c507756c4c11584128753e53d656ec4f2945fc (patch)
tree569095f06e9edef58358d47ef54a7e95c166b6e3 /phpBB/db/postgres7.php
parent03923a266582792ce0bb1727e96082ff00f74e8a (diff)
downloadforums-60c507756c4c11584128753e53d656ec4f2945fc.tar
forums-60c507756c4c11584128753e53d656ec4f2945fc.tar.gz
forums-60c507756c4c11584128753e53d656ec4f2945fc.tar.bz2
forums-60c507756c4c11584128753e53d656ec4f2945fc.tar.xz
forums-60c507756c4c11584128753e53d656ec4f2945fc.zip
Fixed LIMIT and other issues
git-svn-id: file:///svn/phpbb/trunk@292 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/db/postgres7.php')
-rw-r--r--phpBB/db/postgres7.php37
1 files changed, 23 insertions, 14 deletions
diff --git a/phpBB/db/postgres7.php b/phpBB/db/postgres7.php
index 3b0eac607f..e2178d4347 100644
--- a/phpBB/db/postgres7.php
+++ b/phpBB/db/postgres7.php
@@ -4,7 +4,7 @@
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
- * email : support@phpbb.com
+ * email : supportphpbb.com
*
* $Id$
*
@@ -49,7 +49,6 @@ class sql_db
}
if($sqlserver)
{
-
if(ereg(":",$sqlserver))
{
list($sqlserver,$sqlport) = split(":",$sqlserver);
@@ -57,7 +56,10 @@ class sql_db
}
else
{
- $this->connect_string .= "host=$sqlserver ";
+ if($sqlserver != "localhost")
+ {
+ $this->connect_string .= "host=$sqlserver ";
+ }
}
}
if($database)
@@ -98,7 +100,7 @@ class sql_db
{
if($this->query_result)
{
- @pg_freeresult($this->query_result);
+ pg_freeresult($this->query_result);
}
$result = @pg_close($this->db_connect_id);
return $result;
@@ -119,6 +121,8 @@ class sql_db
unset($this->query_result);
if($query != "")
{
+ $query = preg_replace("/LIMIT ([0-9]+),([ 0-9]+)/", "LIMIT \\2, \\1", $query);
+
$this->query_result = @pg_exec($this->db_connect_id, $query);
if($this->query_result)
{
@@ -230,12 +234,16 @@ class sql_db
}
if($query_id)
{
- $this->row = @pg_fetch_array($query_id, $this->rownum[$query_id]);
+ $this->row = @pg_fetch_array($query_id, $this->rownum[$query_id], PGSQL_ASSOC);
if($this->row)
{
$this->rownum[$query_id]++;
+ return $this->row;
+ }
+ else
+ {
+ return false;
}
- return $this->row;
}
else
{
@@ -254,7 +262,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]))
+ while($this->rowset = @pg_fetch_array($query_id, $this->rownum[$query_id], PGSQL_ASSOC))
{
$result[] = $this->rowset;
$this->rownum[$query_id]++;
@@ -276,17 +284,17 @@ class sql_db
{
if($row_offset != -1)
{
- $this->row = @pg_fetch_array($query_id, $row_offset);
+ $this->row = @pg_fetch_array($query_id, $row_offset, PGSQL_ASSOC);
}
else
{
if($this->rownum[$query_id])
{
- $this->row = @pg_fetch_array($query_id, $this->rownum[$query_id]-1);
+ $this->row = @pg_fetch_array($query_id, $this->rownum[$query_id]-1, PGSQL_ASSOC);
}
else
{
- $this->row = @pg_fetch_array($query_id, $this->rownum[$query_id]);
+ $this->row = @pg_fetch_array($query_id, $this->rownum[$query_id], PGSQL_ASSOC);
if($this->row)
{
$this->rownum[$query_id]++;
@@ -332,12 +340,13 @@ class sql_db
{
if( eregi("^(INSERT{1}|^INSERT INTO{1})[[:space:]][\"]?([a-zA-Z0-9\_\-]+)[\"]?", $this->last_query_text[$query_id], $tablename))
{
- $query = "SELECT last_value FROM ".$tablename[2]."_id_seq";
- $temp_q_id = pg_exec($this->db_connect_id, $query);
- $temp_result = pg_fetch_array($temp_q_id, 0);
+ $query = "SELECT last_value
+ FROM ".$tablename[2]."_id_seq";
+ $temp_q_id = @pg_exec($this->db_connect_id, $query);
+ $temp_result = @pg_fetch_array($temp_q_id, 0, PGSQL_ASSOC);
if($temp_result)
{
- return $temp_result["last_value"]+1;
+ return $temp_result['last_value']+1;
}
else
{