I want the query ‘SET NAMES utf8’ to execute before any other queries.
But, if I execute it in the beginning of my app, it forces Zend_Db to connect to the Database, even if I’m not running any other queries. It isn’t cool: My app processes lots of requests without any queries, only using cache.
How to ask Zend_Db to run ‘SET NAMES utf8’ right after connection?
Sure, simply pass the ‘charset’ option in with the adapter params. You can do this via Zend_Config or in code:
Reference: http://framework.zend.com/manual/en/zend.db.html#zend.db.adapter.connecting.parameters