2008年8月5日星期二

[fw-db] Zend_Db_Table improvement to avoid hard parsing when using Oracle

Hello,

I have an app that uses multiple identical queries to Zend_Db_Table::fetchAll() and ::fetchRow() using different params.

The current implementation quotes the params in the query string, thus resulting in unnecessary hard parsing (see http://www.adp-gmbh.ch/ora/misc/hard_parse_vs_soft_parse.html for details).

I attached a patch that implements a possible solution as well as a couple of relevant tests : an extra $bind parameter to _fetch(), fetchAll() and fetchRow() that is passed to the adapter’s  query() method. So, in effect, one would be able to write:


$table = $this->_table['bugs'];

$select = $table->select();         $select->where( 'reported_by = :reported');         $bind = array( 'reported' => 'goofy' );

$rowset = $table->fetchAll( $select, null, null, null, $bind );


Please let me know if this is useful and how I should go about to committing the patch to SVN.

Thanks!
Sorin

没有评论: