Ignore:
Timestamp:
Mar 21, 2010, 11:51:36 PM (14 years ago)
Author:
nikrou
Message:

Feature 1255 :
only one function
use exceptions to deal with differents possible errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/dblayer/functions_pgsql.inc.php

    r5230 r5236  
    3434 */
    3535
    36 function pwg_db_connect($host, $user, $password, $database, $die=true)
     36function pwg_db_connect($host, $user, $password, $database)
    3737{
    3838  $connection_string = '';
     
    5050                                $password,
    5151                                $database);
    52   $link = pg_connect($connection_string) or my_error('pg_connect', $die); 
    53 
    54   return $link;
     52  $link = pg_connect($connection_string);
     53  if (!$link)
     54  {
     55    throw new Exception("Can't connect to server");
     56  }
     57  else
     58  {
     59    return $link;
     60  }
    5561}
    5662
Note: See TracChangeset for help on using the changeset viewer.