2 /***********************************************************************
4 Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org)
6 This file is part of PunBB.
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.
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.
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,
23 ************************************************************************/
26 // Make sure no one attempts to run this script "directly"
32 // Return current timestamp (with microseconds) as a float (used in dblayer)
34 if (defined('PUN_SHOW_QUERIES'))
36 function get_microtime()
38 list($usec, $sec) = explode(' ', microtime());
39 return ((float)$usec +
(float)$sec);
44 // Load the appropriate DB layer class
48 require PUN_ROOT
.'include/dblayer/mysql.php';
52 require PUN_ROOT
.'include/dblayer/mysqli.php';
56 require PUN_ROOT
.'include/dblayer/pgsql.php';
60 require PUN_ROOT
.'include/dblayer/sqlite.php';
64 error('\''.$db_type.'\' is not a valid database type. Please check settings in config.php.', __FILE__
, __LINE__
);
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);