Show the full SQL query when you get Magento SQL errors

If you’ve ever been coding in Magento you may have seen an error like this:

01-01-2013_10-57-13_pm

Obviously an error message like that makes it pretty tough to figure out what is wrong. You can make your SQL error reports show much more data to help with debugging and look like this:

01-01-2013_10-56-06_pm

To do this edit your /lib/Zend/Db/Statement/Pdo.php file and replace line 234 in this file with the following code.

Make sure you don’t let this code get into your production environment though as showing the full SQL can sometimes reveal private data in the event of an error.

One thought on “Show the full SQL query when you get Magento SQL errors

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s