Hi,

I would not use "Parsed SQL" though, as it's not just the result of
> parsing. In fact it could effectively be what has been sent to the backend,
> regardless of statement emulation...
>

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.

Basically, you'd never see this kind of example:

SQL: "SELECT * FROM tbl WHERE x = ?"
> Sent SQL: "SELECT * FROM tbl WHERE x = $1"
>

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.

Thanks,
Adam

Reply via email to