Changeset 5230 for trunk/include


Ignore:
Timestamp:
Mar 21, 2010, 10:15:54 PM (14 years ago)
Author:
patdenice
Message:

feature 1255: add pwg_select_db function.

Location:
trunk/include
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/common.inc.php

    r5215 r5230  
    106106// Database connection
    107107$pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'],
    108                               $conf['db_password'], $conf['db_base'])
    109   or my_error('pwg_db_connect', true);
     108                              $conf['db_password'], $conf['db_base']);
     109pwg_select_db($conf['db_base'], $pwg_db_link);
    110110
    111111pwg_db_check_charset();
  • trunk/include/dblayer/functions_mysql.inc.php

    r5196 r5230  
    3333 */
    3434
    35 function pwg_db_connect($host, $user, $password, $database)
     35function pwg_db_connect($host, $user, $password, $database=null, $die=true)
    3636
    37   $link = mysql_connect($host, $user, $password) or my_error('mysql_connect', false);
    38   mysql_select_db($database, $link) or my_error('mysql_select_db', false);
     37  $link = @mysql_connect($host, $user, $password) or my_error('mysql_connect', $die);
    3938
    4039  return $link;
     40}
     41
     42function pwg_select_db($database, $link, $die=true)
     43{
     44  return @mysql_select_db($database, $link) or my_error('mysql_select_db', $die);
    4145}
    4246
  • trunk/include/dblayer/functions_pdo-sqlite.inc.php

    r5196 r5230  
    3434 */
    3535
    36 function pwg_db_connect($host, $user, $password, $database)
     36function pwg_db_connect($host, $user, $password, $database, $die=true)
    3737{
    3838  global $conf;
     
    4343    $link = new PDO($db_file);
    4444  } catch (Exception $e) {
    45     my_error('sqlite::open', true);
     45    my_error('sqlite::open', $die);
    4646  }
    4747
     
    5555
    5656  return $link;
     57}
     58
     59function pwg_select_db($database=null, $link=null, $die=null)
     60{
     61  return true;
    5762}
    5863
  • trunk/include/dblayer/functions_pgsql.inc.php

    r5196 r5230  
    3434 */
    3535
    36 function pwg_db_connect($host, $user, $password, $database)
     36function pwg_db_connect($host, $user, $password, $database, $die=true)
    3737{
    3838  $connection_string = '';
     
    5050                                $password,
    5151                                $database);
    52   $link = pg_connect($connection_string) or my_error('pg_connect', false); 
     52  $link = pg_connect($connection_string) or my_error('pg_connect', $die); 
    5353
    5454  return $link;
     55}
     56
     57function pwg_select_db($database=null, $link=null, $die=null)
     58{
     59  return true;
    5560}
    5661
  • trunk/include/dblayer/functions_sqlite.inc.php

    r5196 r5230  
    3434 */
    3535
    36 function pwg_db_connect($host, $user, $password, $database)
     36function pwg_db_connect($host, $user, $password, $database, $die=true)
    3737{
    3838  global $conf;
     
    5151    $link = new SQLite3($db_file, $sqlite_open_mode);
    5252  } catch (Exception $e) {
    53     my_error('sqlite::open', true);
     53    my_error('sqlite::open', $die);
    5454  }
    5555
     
    6363
    6464  return $link;
     65}
     66
     67function pwg_select_db($database=null, $link=null, $die=null)
     68{
     69  return true;
    6570}
    6671
Note: See TracChangeset for help on using the changeset viewer.