Req #44319 [Opn->Csd]: Add access to actual query sent to DB

From: Date: Mon, 24 Apr 2017 19:12:17 +0000
Subject: Req #44319 [Opn->Csd]: Add access to actual query sent to DB
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208761@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=44319&edit=1 ID: 44319 Updated by: adambaratz@php.net Reported by: joe at digg dot com Summary: Add access to actual query sent to DB -Status: Open +Status: Closed Type: Feature/Change Request Package: PDO related Operating System: All PHP Version: 5.2.5 -Assigned To: +Assigned To: adambaratz Block user comment: N Private report: N New Comment: This feature will be released with PHP 7.2 for emulated prepared statements: https://wiki.php.net/rfc/debugging_pdo_prepared_statement_emulation_v2 It's not possible for true prepared statements since there is no literal SQL executed. Previous Comments: ------------------------------------------------------------------------ [2008-03-03 22:10:34] 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? ------------------------------------------------------------------------ [2008-03-03 21:46:26] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=44319&edit=1

« previous php.bugs (#208761) next »