I was thinking today about database APIs when inspiration struck. I ended up hacking out the following class, which I think demonstrates a rather interesting approach to interfacing with a database (interesting enough at least to post here). class DBQuery implements Iterator {     protected $_db;     protected $_query;     protected $_result;     protected $_index;     protected $_num_rows;         public function __construct($host, $dbname, $username,         $password) {         $this->_db = new PDO("mysql:dbname=$dbname;host=$host",         $username, $password);     }         public function __get($query) {         $this->_query = $query;         $this->_result = $this->_db->query($query);         return $this->_num_rows = $this->_result->rowCount();     }         public function quote($value) {         return PDO::quote($value);     }         public function __call($query, $values) {         $this->_query = $query;         $this->_result = $...
The Blog of Timothy Boronczyk - running my mouth off one blog post at a time