DBType = strtolower($db['type']); $this->Database = $db['database']; if ($this->DBType != 'sqlite') { $this->Hostname = $db['hostname']; $this->Username = $db['username']; $this->Password = $db['password']; } $this->Connect(); } public function Connect($dbtype=NULL, $database=NULL, $hostname=NULL, $username=NULL, $password=NULL) { if ($dbtype != NULL) $this->DBType = strtolower($dbtype); if ($database != NULL) $this->Database = $database; if ($hostname != NULL) $this->Hostname = $hostname; if ($username != NULL) $this->Username = $username; if ($password != NULL) $this->Password = $password; switch ($this->DBType) { case 'sqlite': $this->Handle = new SQLitedb($this->Database); break; case 'mysql': $this->Handle = new MySQLdb($this->Hostname, $this->Username, $this->Password, $this->Database); break; case 'mysqli': $this->Handle = new MySQLidb($this->Hostname, $this->Username, $this->Password, $this->Database); break; case 'pgsql': $this->Handle = new PgSQLdb($this->Hostname, $this->Username, $this->Password, $this->Database); break; } } public function AutoCommit($bool) { $this->Handle->AutoCommit($bool); } public function Commit() { return $this->Handle->Commit(); } public function RollBack() { return $this->Handle->RollBack(); } public function Prepare($name, $query) { return $this->Handle->Prepare($name, $query); } public function Execute($name, $result_type=DatabaseCommon::DB_BUFFERED_RESULT) { return $this->Handle->Execute($name); } public function Query($query, $result_type=DatabaseCommon::DB_BUFFERED_RESULT) { ex_debug('Query: ' . $query, 2); return $this->Handle->Query($query); } public function GetRow($query=NULL) { ex_debug('GetRow: ' . $query, 2); return $this->Handle->GetRow($query); } public function GetResult() { return $this->Handle->GetResult(); } } ?>