mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 20:30:11 +01:00
39 lines
790 B
PHP
39 lines
790 B
PHP
|
<?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();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
?>
|