2006-08-19 07:04:45 +00:00
|
|
|
<?php
|
2005-09-07 12:17:16 +00:00
|
|
|
|
|
|
|
require_once "config.php";
|
|
|
|
|
2013-03-15 15:54:08 +00:00
|
|
|
$db_class = 'Db_'.ucfirst(DB_TYPE);
|
|
|
|
$db_class_file = 'classes/' . str_replace('_', '/', $db_class) . '.php';
|
|
|
|
|
|
|
|
require_once "classes/Db/Interface.php";
|
|
|
|
require_once "classes/Db/Abstract.php";
|
|
|
|
require_once $db_class_file;
|
2013-03-15 09:51:33 +00:00
|
|
|
|
|
|
|
$db = $db_class::instance(); // call_user_func(array($db_class, 'instance'));
|
|
|
|
|
|
|
|
function db_connect($host, $user, $pass, $db_name) {
|
|
|
|
global $db;
|
|
|
|
return $db->connect($host, $user, $pass, $db_name);
|
2005-09-07 12:17:16 +00:00
|
|
|
}
|
|
|
|
|
2011-02-19 13:55:36 +00:00
|
|
|
function db_escape_string($s, $strip_tags = true) {
|
2013-03-15 09:51:33 +00:00
|
|
|
global $db;
|
|
|
|
return $db->escape_string($s, $strip_tags);
|
2005-09-07 12:17:16 +00:00
|
|
|
}
|
|
|
|
|
2006-08-13 04:46:40 +00:00
|
|
|
function db_query($link, $query, $die_on_error = true) {
|
2013-03-15 09:51:33 +00:00
|
|
|
global $db;
|
|
|
|
return $db->query($query, $die_on_error);
|
2005-09-07 12:17:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function db_fetch_assoc($result) {
|
2013-03-15 09:51:33 +00:00
|
|
|
global $db;
|
|
|
|
return $db->fetch_assoc($result);
|
2005-09-07 12:17:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function db_num_rows($result) {
|
2013-03-15 09:51:33 +00:00
|
|
|
global $db;
|
|
|
|
return $db->num_rows($result);
|
2005-09-07 12:17:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function db_fetch_result($result, $row, $param) {
|
2013-03-15 09:51:33 +00:00
|
|
|
global $db;
|
|
|
|
return $db->fetch_result($result, $row, $param);
|
2005-09-07 12:17:16 +00:00
|
|
|
}
|
|
|
|
|
2005-10-16 14:48:33 +00:00
|
|
|
function db_unescape_string($str) {
|
2013-03-15 09:51:33 +00:00
|
|
|
global $db;
|
|
|
|
return $db->unescape_string($str);
|
2005-10-16 14:48:33 +00:00
|
|
|
}
|
|
|
|
|
2005-09-07 12:17:16 +00:00
|
|
|
function db_close($link) {
|
2013-03-15 09:51:33 +00:00
|
|
|
global $db;
|
|
|
|
return $db->close();
|
2005-09-07 12:17:16 +00:00
|
|
|
}
|
2005-10-17 03:45:44 +00:00
|
|
|
|
2006-05-16 12:37:35 +00:00
|
|
|
function db_affected_rows($link, $result) {
|
2013-03-15 09:51:33 +00:00
|
|
|
global $db;
|
|
|
|
return $db->affected_rows($result);
|
2006-05-16 12:56:53 +00:00
|
|
|
}
|
2006-08-16 07:28:10 +00:00
|
|
|
|
|
|
|
function db_last_error($link) {
|
2013-03-15 09:51:33 +00:00
|
|
|
global $db;
|
|
|
|
return $db->last_error();
|
2006-08-16 07:28:10 +00:00
|
|
|
}
|
|
|
|
|
2011-08-11 22:51:00 +00:00
|
|
|
function db_quote($str){
|
2013-03-15 09:51:33 +00:00
|
|
|
global $db;
|
|
|
|
return $db->quote($str);
|
2011-08-11 22:51:00 +00:00
|
|
|
}
|
|
|
|
|
2013-03-15 15:54:08 +00:00
|
|
|
?>
|