I'm not sure the reasoning for the monitoring, but the proper way to monitor table modifications would be through a trigger on the table themselves, updating to either a copy of itself or a log based table of modifications done.
However, if you must go the code route, the simplestest way, is to go to the source: extend Zend_Db. Make $this->_db your new extended class, then inject your added code into your new query() method, then call parent::query(). /hug the flexibility of OO programming. Now, I think, but not sure, Zend_Db can also do class injection, but I don't have a clue where it would be done at or what the syntax it. Maybe not ... but I do know a number of Zend classes allow class injection (aka dependency injection). --- Philip [email protected] http://www.gpcentre.net/ On Fri, Oct 23, 2009 at 5:47 PM, David Zapata <[email protected]>wrote: > > Good day. > > I'm having a problem with some models usign Zend Framework. The models we > have extend from Zend_Db_Table. The most of the methods are using Zend_Logs > inside to track the executed queries and other data (in development > environment). Some of the queries, I mean, the insert, delete or update > queries, are executed using $this->_db->query( $str_sql ) where $str_sql is > a string (made by hand, not using Zend objects) containing the SQL code. > > I've been asked to implement a Zend_Log object with a Zend_Log_Writer_Db to > log only the SQL queries that edit data (used manually before every > $this->_db->query( $str_sql ) execution). > > Of course, I know this is not the right way to use Zend_Models, but I must > find a way to replace the Zend_Log_Writer_Db, and use instead another > query() execution that inserts only a log in a database table if the query > in execution is a Insert, update or delete... This must be done automaticly > by the Model class. > > I've searched in google a lot about overwriting the query() method, or > creating a helper class that I can use to extend it in our model classes, > but I can't find a may... > > Please, show me some light about this... > -- > View this message in context: > http://www.nabble.com/Log-only-insert%2C-update-or-delete-queries-tp26034303p26034303.html > Sent from the Zend Framework mailing list archive at Nabble.com. > >
