Can anyone tell me how to determine query type i.e. select, update, delete or insert before it is executed over MySQL.
I strongly belie
EDIT : I was looking at the code for the Zend_Db_Table and Zend_Db_Table_Abstract and my second solution seems much more difficult now.
Hey guys,
If you want to give yourself a bit of a headache, what you can do is keep using the multidb resource to create two connections, one to the slave and one for the master.
Set the default connection to the one that will be used the most.
Then, with the other connection you can fetch it manually every time you need to use it and deal directly with the adapter instead of going through the DbTable class.
For example, create another method for the mapper classes called getOtherDbAdapter() that gets the other adapter. Then you can use the adapter from there to perform selects or inserts.
OH!
Another solution is that you can extend extend the class Zend_Db_Table or Zend_Db_Table_Abstract and create another variable for the second db connection.
Then, copy and paste the implementation code for all the fetch/select/insert/update methods from the Zend_Db_Table_Abstract class and have it use the the other adapter whenever you see the code performing the operations you want to have redirected to the other db.