ttrss/include/db.php

69 lines
1.4 KiB
PHP
Raw Normal View History

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