aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/postgres.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2003-06-12 17:11:43 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2003-06-12 17:11:43 +0000
commitdee0f40fd2b27f441c2f4b60382c7985b9f0789d (patch)
tree3dc96c29982897336ad66c44dc1d5d1d2ec1b641 /phpBB/includes/db/postgres.php
parent68f6998a4cc3f2dc0f839712427d246acf055c55 (diff)
downloadforums-dee0f40fd2b27f441c2f4b60382c7985b9f0789d.tar
forums-dee0f40fd2b27f441c2f4b60382c7985b9f0789d.tar.gz
forums-dee0f40fd2b27f441c2f4b60382c7985b9f0789d.tar.bz2
forums-dee0f40fd2b27f441c2f4b60382c7985b9f0789d.tar.xz
forums-dee0f40fd2b27f441c2f4b60382c7985b9f0789d.zip
various fixes and alterations
git-svn-id: file:///svn/phpbb/trunk@4118 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/db/postgres.php')
-rw-r--r--phpBB/includes/db/postgres.php38
1 files changed, 30 insertions, 8 deletions
diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php
index 644fba48b0..8f916eae99 100644
--- a/phpBB/includes/db/postgres.php
+++ b/phpBB/includes/db/postgres.php
@@ -38,7 +38,7 @@ class sql_db
//
// Constructor
//
- function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
+ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->connect_string = "";
@@ -76,9 +76,19 @@ class sql_db
$this->persistency = $persistency;
- $this->db_connect_id = ($this->persistency) ? pg_pconnect($this->connect_string) : pg_connect($this->connect_string);
+ $this->db_connect_id = ($this->persistency) ? @pg_pconnect($this->connect_string) : @pg_connect($this->connect_string);
- return ($this->db_connect_id) ? $this->db_connect_id : false;
+ return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
+ }
+
+ function sql_return_on_error($fail = false)
+ {
+ $this->return_on_error = $fail;
+ }
+
+ function sql_num_queries()
+ {
+ return $this->num_queries;
}
//
@@ -351,15 +361,27 @@ class sql_db
return ($query_id) ? @pg_freeresult($query_id) : false;
}
- function sql_error($query_id = 0)
+ function sql_error($sql = '')
{
- if (!$query_id)
+
+ if (!$this->return_on_error)
{
- $query_id = $this->query_result;
+ if ($this->transaction)
+ {
+ $this->sql_transaction('rollback');
+ }
+
+ $this_page = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF'];
+ $this_page .= '&' . ((!empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING']);
+
+ $message = '<u>SQL ERROR</u> [ ' . SQL_LAYER . ' ]<br /><br />' . @pg_errormessage() . '<br /><br /><u>CALLING PAGE</u><br /><br />' . htmlspecialchars($this_page) . (($sql != '') ? '<br /><br /><u>SQL</u><br /><br />' . $sql : '') . '<br />';
+ trigger_error($message, E_USER_ERROR);
}
- $result['message'] = @pg_errormessage($this->db_connect_id);
- $result['code'] = -1;
+ $result = array(
+ 'message' => @pg_errormessage(),
+ 'code' => ''
+ );
return $result;
}