ttrss/include/db.php

66 lines
1.2 KiB
PHP

<?php
require_once "config.php";
require_once "classloader.php";
$db_class = 'db_'.lcfirst(DB_TYPE);
$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();
}
function db_affected_rows($link, $result) {
global $db;
return $db->affected_rows($result);
}
function db_last_error($link) {
global $db;
return $db->last_error();
}
function db_quote($str){
global $db;
return $db->quote($str);
}
?>