2009年7月30日星期四

Re: [fw-db] view complete sql statement on error

I have tried using ZFdebug and zend.db.profiler via firebug .. but nothing seem to work .. I couldnt see anything.

I manage to see the complete query for select statement by using this

$select = $this->getDbTable()->select()->where('id = ?', $id);
Zend_Debug::Dump($select->assemble());
exit;

but for :
insert ($this->getDbTable()->insert($data);) and 
update ($this->getDbTable()->update($data, $where);).. 
i couldnt see it ..

I am using zf 1.8.4 and Zend_Db_Table for the database query.

Any help is appreciated.

Thank you,
Ari



On Jul 30, 2009, at 6:19 PM, Саша Стаменковић wrote:

You can use profiler http://framework.zend.com/manual/en/zend.db.profiler.html, it's handy to print them to firebug when in test env. Or use Scienta ZF Debug Bar. Or simply echo your statement.

Regards,
Saša Stamenković


On Thu, Jul 30, 2009 at 10:49 AM, Ari Awan <ariawan.jp@gmail.com> wrote:
Hi all,

Is there a way to make stack trace to display the whole generated SQL statement when there is an error instead just the first few characters of it?

This is what it currently displays

#3 ... /library/Zend/Db/Adapter/Abstract.php(542):
Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `us...', Array)
#4 ... /library/Zend/Db/Table/Abstract.php(955):
Zend_Db_Adapter_Abstract->insert('user', Array)

..and I would like to see the whole update statement before sent to the db to track what is wrong with it.

Thanks for the help!

Ari


没有评论: