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_pdo-sqlite.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  global $conf;
     
    4040  $db_file = sprintf('sqlite:%s/%s.db', $conf['local_data_dir'], $database);
    4141
    42   try {
    43     $link = new PDO($db_file);
    44   } catch (Exception $e) {
    45     my_error('sqlite::open', $die);
     42  $link = new PDO($db_file);
     43  if (!$link)
     44  {
     45    throw new  Exception('Connection to server succeed, but it was impossible to connect to database');
    4646  }
    4747
     
    5555
    5656  return $link;
    57 }
    58 
    59 function pwg_select_db($database=null, $link=null, $die=null)
    60 {
    61   return true;
    6257}
    6358
Note: See TracChangeset for help on using the changeset viewer.