views:

30

answers:

1

How can i find the sql query statement in Zend Framework for insert(), like its done for db table select's. $select->__toString().

A: 

You can't extract it since it's executed right away, but the code exists in Zend_Db_Adapter_Abstract::insert() and possibly overwritten in some of the adapters.

chelmertz
but can i echo it in somewhere inside the core class say in any abstract classes i tried in some classes inside the insert()'s but i get only the placeholders, i just want to see the raw query...
Unni Krishnan
@Unni Krishnan: since the query is executed through a prepared statement: the db receives the query with placeholders first, any any bindings later on. Much more safe that way, with the side effect that you cannot see the final query. To do that, either a) do as you say but replace each ? with the actual value; or b) read the database query log.
chelmertz