Displaying the generated SQL from a ZendDbSql object
If you use ZendDbSql to generate your SQL, then it's useful to find out what the generated SQL looks like. Consider code like this: public function fetchAllWithTitleSince($title, $since) { $sql = new Sql($this->dbAdapter); $select = $sql->select(); $select->from($this->tableName); $select->columns(array('id', 'title', 'url', 'date_updated')); $select->where->like('title', "%$title%"); $select->where->greaterThanOrEqualTo('date_created', date('Y-m-d', strtotime($since))); $statement = $this->dbAdapter->createStatement(); $select->prepareStatement($this->dbAdapter, $statement); return $statement->execute(); } To find out what the generated SQL will look like, you can use the $select's getSqlString() method: $select->getSqlString(); For me, this… continue reading.