News Feed
Jobs Feed
Sections




News Archive
Davey Shafik's Blog:
Debugging PDO Prepared Statements
May 20, 2009 @ 09:35:01

In a recent post to his blog, Davey Shafik looks at solving something that has "always bugged him about using prepared statements" - getting the actual query it used back out.

Today, a friend asking me if it was possible to get a prepared statement back from PDO with the values placeholders replaced, finally caught me in a moment where I could do something about it. I wrote a thin PDO wrapper class that will [imperfectly, I'm sure] return the completed query.

His class (complete code included in the post) includes a getSQL() method that hands you back the results of your bound parameter query as a string. A few examples of its use are also included.

0 comments voice your opinion now!
sql bind debug pdo


blog comments powered by Disqus

Similar Posts

PHPBuilder.com: Pro PHP Security / Preventing SQL Injection, Part 3

Internet Super Hero Blog: PDO_MYSQLND for PHP preview released

Martynas Jusevicius' Blog: Calculating great-circle distance in MySQL and Propel

Stuart Herbert's Blog: Learning PHP Data Objects, by Dennis Popel

Markus Wolff's Blog: ActiveRecord enhancements


Community Events











Don't see your event here?
Let us know!


interview release community introduction conference database language usergroup symfony2 series zendframework2 rest phpunit opinion framework development functional testing unittest podcast

All content copyright, 2013 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework