Changed include directory of db.postgres.php
[gnucomo.git] / src / phpclasses / db.class.php
1 <?php
2
3 /**********************************************************************************
4 **  (c) Copyright 2002, Brenno J.S.A.A.F. de Winter, De Winter Information Soltions
5 ** This is free software; you can redistribute it and/or modify it under the
6 ** terms of the GNU General Public License, see the file COPYING.
7 ***********************************************************************************/
8
9
10    function db_select ($inp_dbms) {
11    /* This function delivers some robustness to several names that can be used
12     * for the same database. Multiple names are interpreted as a standard name.
13     * If no valid name has been entered a warning will be given.
14     * Input-values: 
15     *   - $inp_dbms: name for the DBMS
16     * Output-values:
17     *   - NONE
18     */
19      $local_db_input = strtolower(trim($inp_dbms));      
20      switch ($local_db_input) {
21         case "postgres":
22           $local_db_type = "postgres";
23           break;
24         case "postgresql":
25           $local_db_type = "postgres";
26           break;
27         case "psql":
28           $local_db_type = "postgres";
29           break;
30         case "pgsql":
31           $local_db_type = "postgres";
32           break;
33         default:
34           syslog(LOG_WARN, "Invalid DBMS read from config-file");
35           $local_db_type = "xxxxx";
36           break;
37       }
38       if ($local_db_type <> "xxxxx") {
39         require_once ("db.".$local_db_type.".php");
40       }
41
42    function copy_db_class ($inp_class) {
43    /* This function takes a database class, sets the values for the connection,
44     * opens the connection and returns the new cloned class
45     * INPUT     : inp_class   - Typically a database class
46     * OUTPUT    : Class       - with cloned database.
47     */
48
49     $new_class = new db();
50     $new_class->db_host     = $inp_class->db_host;
51     $new_class->db_name     = $inp_class->db_name;
52     $new_class->db_user     = $inp_class->db_user;
53     $new_class->db_password = $inp_class->db_password;
54     $new_class->db_connect();
55     return $new_class;
56
57    }
58       
59    }
60 ?>