2006-08-19 09:04:45 +02:00
|
|
|
<?php
|
2005-09-07 14:17:16 +02:00
|
|
|
|
|
|
|
require_once "config.php";
|
|
|
|
|
2013-03-15 16:54:08 +01: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 10:51:33 +01: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 14:17:16 +02:00
|
|
|
}
|
|
|
|
|
2011-02-19 14:55:36 +01:00
|
|
|
function db_escape_string($s, $strip_tags = true) {
|
2013-03-15 10:51:33 +01:00
|
|
|
global $db;
|
|
|
|
return $db->escape_string($s, $strip_tags);
|
2005-09-07 14:17:16 +02:00
|
|
|
}
|
|
|
|
|
2006-08-13 06:46:40 +02:00
|
|
|
function db_query($link, $query, $die_on_error = true) {
|
2013-03-15 10:51:33 +01:00
|
|
|
global $db;
|
|
|
|
return $db->query($query, $die_on_error);
|
2005-09-07 14:17:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function db_fetch_assoc($result) {
|
2013-03-15 10:51:33 +01:00
|
|
|
global $db;
|
|
|
|
return $db->fetch_assoc($result);
|
2005-09-07 14:17:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function db_num_rows($result) {
|
2013-03-15 10:51:33 +01:00
|
|
|
global $db;
|
|
|
|
return $db->num_rows($result);
|
2005-09-07 14:17:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function db_fetch_result($result, $row, $param) {
|
2013-03-15 10:51:33 +01:00
|
|
|
global $db;
|
|
|
|
return $db->fetch_result($result, $row, $param);
|
2005-09-07 14:17:16 +02:00
|
|
|
}
|
|
|
|
|
2005-10-16 16:48:33 +02:00
|
|
|
function db_unescape_string($str) {
|
2013-03-15 10:51:33 +01:00
|
|
|
global $db;
|
|
|
|
return $db->unescape_string($str);
|
2005-10-16 16:48:33 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 14:17:16 +02:00
|
|
|
function db_close($link) {
|
2013-03-15 10:51:33 +01:00
|
|
|
global $db;
|
|
|
|
return $db->close();
|
2005-09-07 14:17:16 +02:00
|
|
|
}
|
2005-10-17 05:45:44 +02:00
|
|
|
|
2006-05-16 14:37:35 +02:00
|
|
|
function db_affected_rows($link, $result) {
|
2013-03-15 10:51:33 +01:00
|
|
|
global $db;
|
|
|
|
return $db->affected_rows($result);
|
2006-05-16 14:56:53 +02:00
|
|
|
}
|
2006-08-16 09:28:10 +02:00
|
|
|
|
|
|
|
function db_last_error($link) {
|
2013-03-15 10:51:33 +01:00
|
|
|
global $db;
|
|
|
|
return $db->last_error();
|
2006-08-16 09:28:10 +02:00
|
|
|
}
|
|
|
|
|
2011-08-12 00:51:00 +02:00
|
|
|
function db_quote($str){
|
2013-03-15 10:51:33 +01:00
|
|
|
global $db;
|
|
|
|
return $db->quote($str);
|
2011-08-12 00:51:00 +02:00
|
|
|
}
|
|
|
|
|
2013-03-15 16:54:08 +01:00
|
|
|
?>
|