Database Abstraction
public php v1 · immutable<?phpclass DataHelper{ private $dbh = null; public __construct($dsn = '') { if (is_empty($dsn)) { $dsn = "some default connex string"; } } public connect() { if (is_null($this->dbh)) { $this->dbh = DB::connect($dsn); } if (PEAR::isError($this->dbh)) { throw new Exception($this->dbh->getMessage()); } } public query($queryString, array $params = array()) { // code }}