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