php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #44319 Add access to actual query sent to DB
Submitted: 2008-03-03 21:46 UTC Modified: 2011-04-08 21:27 UTC
Votes:3
Avg. Score:3.7 ± 1.9
Reproduced:2 of 3 (66.7%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: joe at digg dot com Assigned:
Status: Open Package: PDO related
PHP Version: 5.2.5 OS: All
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-03-03 21:46 UTC] joe at digg dot com
Description:
------------
PEAR's DB (and others?) has a property called DB::$last_query that gives access to the *actual* query sent to the database. For the life of me I can't find this functionality in PDO and it's insanely useful for logging, debugging, etc. I doubt it'd be a big deal to add. 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-03 22:10 UTC] joe at digg dot com
I just looked through the code. Looks like what I'm asking for is access to stmt->active_query_string which is in PDOStatement::execute()'s code. I'll poke around a bit more. I'd like access to it whether the statement executes successfully or not so it makes sense to expose it via a member variable. 

I can probably come up with a patch, but would want to do it in a way that'd actually get accepted. Thoughts?
 [2011-04-08 21:27 UTC] jani@php.net
-Package: Feature/Change Request +Package: PDO related
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 17:01:58 2014 UTC