<?php
class DB
{
    private $driver;
    private $cacher;
    
    public function __construct($driver, $hostname, $username, $password, $database)
    {
        if (file_exists(DIR_DATABASE . $driver . '.php')) {
            require_once(VQMod::modCheck(DIR_DATABASE . $driver . '.php'));
        } else {
            exit('Error: Could not load database file ' . $driver . '!');
        }
        
        $this->driver = new $driver($hostname, $username, $password, $database);
        $this->cacher = new QCache();
    }
    
    public function query($sql, $cache_ttl = NULL)
    {
        return $this->driver->query($sql, $this->driver, debug_backtrace(), $cache_ttl);
    }
    
    public function escape($value)
    {
        return $this->driver->escape($value);
    }
    
    public function countAffected()
    {
        return $this->driver->countAffected();
    }
    
    public function getLastId()
    {
        return $this->driver->getLastId();
    }
}
?>