piler/webui/system/db.php

39 lines
790 B
PHP
Raw Normal View History

2012-02-08 23:14:28 +01:00
<?php
class DB {
private $driver;
private $prefix;
public function __construct($driver, $hostname, $username, $password, $database, $prefix = NULL) {
if (!@require_once(DIR_DATABASE . $driver . '.php')) {
exit('Error: Could not load database file ' . $driver . '!');
}
$this->driver = new $driver($hostname, $username, $password, $database, $prefix);
$this->database = $database;
}
public function select_db($db) {
$this->driver->select_db($db);
}
public function query($sql, $arr = array()) {
return $this->driver->query($sql, $arr);
}
public function countAffected() {
return $this->driver->countAffected();
}
public function getLastId() {
return $this->driver->getLastId();
}
}
?>