connection = new \SYSTEM\DB\ConnectionPG($dbinfo); } else if ($dbinfo instanceof \SYSTEM\DB\DBInfoMYS){ $this->connection = new \SYSTEM\DB\ConnectionMYS($dbinfo); } else if ($dbinfo instanceof \SYSTEM\DB\DBInfoAMQP){ $this->connection = new \SYSTEM\DB\ConnectionAMQP($dbinfo); } else if ($dbinfo instanceof \SYSTEM\DB\DBInfoSQLite){ $this->connection = new \SYSTEM\DB\ConnectionSQLite($dbinfo); } else { throw new \Exception('Could not understand Database Settings. Check ur Database Settings');} } /** * Destruct the Database Connection upon Destruction. */ public function __destruct(){ unset($this->connection);} /** * Close the Database Connection. * * @return bool Returns true or false depending on success */ public function close(){ return $this->connection->close();} /** * Query the Connection using Prepare Statement * * @param string $stmtName Name of the Statement - espec for PostgreSQL important * @param string $stmt SQL string of the Statement * @param array $values Array of Prepare Values * @return Result Returns Database Query Result. */ public function prepare($stmtName, $stmt, $values){ return $this->connection->prepare($stmtName, $stmt, $values);} /** * Query the Connection using normal Query Statement * * @param string $query SQL string of the Statement * @return Result Returns Database Query Result. */ public function query($query){ return $this->connection->query($query);} /** * Exec Query on Database * * @param string $query SQL string of the Statement * @return Result Returns Database Query Result. */ public function exec($query){ return $this->connection->exec($query);} /** * Open a Transaction on the Database Connection * * @return bool Returns true or false depending on success. */ public function trans(){ return $this->connection->trans();} /** * Commit a Transaction on the Database Connection * * @return bool Returns true or false depending on success. */ public function commit(){ return $this->connection->commit();} }