aboutsummaryrefslogtreecommitdiffstats
path: root/include/dblayer/functions_pgsql.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/dblayer/functions_pgsql.inc.php')
-rw-r--r--include/dblayer/functions_pgsql.inc.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/dblayer/functions_pgsql.inc.php b/include/dblayer/functions_pgsql.inc.php
index fe350d090..5c928c53c 100644
--- a/include/dblayer/functions_pgsql.inc.php
+++ b/include/dblayer/functions_pgsql.inc.php
@@ -33,7 +33,7 @@ define('DB_RANDOM_FUNCTION', 'RANDOM');
*
*/
-function pwg_db_connect($host, $user, $password, $database, $die=true)
+function pwg_db_connect($host, $user, $password, $database)
{
$connection_string = '';
if (strpos($host,':') !== false)
@@ -49,9 +49,15 @@ function pwg_db_connect($host, $user, $password, $database, $die=true)
$user,
$password,
$database);
- $link = pg_connect($connection_string) or my_error('pg_connect', $die);
-
- return $link;
+ $link = pg_connect($connection_string);
+ if (!$link)
+ {
+ throw new Exception("Can't connect to server");
+ }
+ else
+ {
+ return $link;
+ }
}
function pwg_select_db($database=null, $link=null, $die=null)