Hi Adam,
On 29/11/2016 00:16, Adam Baratz wrote:
> I'd be happy to make the feature more specific. The "Parsed" line would
> only show with emulated prepares enabled, after execute() has been called.
> I'd prefer using "Parsed" because the language would be more specific. It
> would also correspond to pdo_parse_params(), the function which does the
> emulation.
Sure, it might be the name of the function, but technically it's parsing
+ interpolation.
> Basically, you'd never see this kind of example:
>
> SQL: "SELECT * FROM tbl WHERE x = ?"
>> Sent SQL: "SELECT * FROM tbl WHERE x = $1"
>>
why not? That's what active_query_string contains e.g. in pdo_pgsql w/o
emulate prepares. Which is more or less what has been sent to the
server, unless cursors are used. I don't see why it is deemed to be
not-useful or less useful than emulated prepares.
In fact it would come in very handy for extended tests of a bugfix I
have in the pipeline.
> I haven't tested, but I'm pretty sure the feature could be implemented by
> adding this block below the first php_stream_printf() call in
> debugDumpParams():
>
> /* show parsed SQL if emulated prepares enabled */
>> /* pointers will be equal if PDO::query() was invoked */
>> if (stmt->active_query_string != NULL && stmt->active_query_string !=
>> stmt->query_string) {
>> php_stream_printf(out, "Parsed SQL: [%zd] %.*s\n",
>> stmt->active_query_stringlen, (int) stmt->active_query_stringlen,
>> stmt->active_query_string);
>> }
>
>
> Let me know what you think of this approach. If it sounds fine, I'll update
> the RFC.
Possibly, but tbh I haven't had time to check.
Cheers
--
Matteo Beccati
Development & Consulting - http://www.beccati.com/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php