mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 01:03:31 +02:00
Feature 1255 :
only one function use exceptions to deal with differents possible errors git-svn-id: http://piwigo.org/svn/trunk@5236 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user