source: branches/rsr.v5.1.dev/web/punbb/include/dblayer/common_db.php @ 2

Last change on this file since 2 was 1, checked in by dj3c1t, 13 years ago

import initial

File size: 1.9 KB
RevLine 
[1]1<?php
2/***********************************************************************
3
4  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)
5
6  This file is part of PunBB.
7
8  PunBB is free software; you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published
10  by the Free Software Foundation; either version 2 of the License,
11  or (at your option) any later version.
12
13  PunBB is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  GNU General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  MA  02111-1307  USA
22
23************************************************************************/
24
25
26// Make sure no one attempts to run this script "directly"
27if (!defined('PUN'))
28        exit;
29
30
31//
32// Return current timestamp (with microseconds) as a float (used in dblayer)
33//
34if (defined('PUN_SHOW_QUERIES'))
35{
36        function get_microtime()
37        {
38                list($usec, $sec) = explode(' ', microtime());
39                return ((float)$usec + (float)$sec);
40        }
41}
42
43
44// Load the appropriate DB layer class
45switch ($db_type)
46{
47        case 'mysql':
48                require PUN_ROOT.'include/dblayer/mysql.php';
49                break;
50
51        case 'mysqli':
52                require PUN_ROOT.'include/dblayer/mysqli.php';
53                break;
54
55        case 'pgsql':
56                require PUN_ROOT.'include/dblayer/pgsql.php';
57                break;
58
59        case 'sqlite':
60                require PUN_ROOT.'include/dblayer/sqlite.php';
61                break;
62
63        default:
64                error('\''.$db_type.'\' n\'est pas un type de base de données valable. Veuillez vérifier vos paramÚtres de configuration dans config.php', __FILE__, __LINE__);
65                break;
66}
67
68
69// Create the database adapter object (and open/connect to/select db)
70$db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect);
Note: See TracBrowser for help on using the repository browser.