Hi,

> 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.
>

active_query_string is only set with emulated prepares. I tried my patch
with pdo_pgsql. "Sent SQL" doesn't appear with real prepares. I put it up
here, with tests, if it'll help try it out:
https://github.com/adambaratz/php-src/commit/a030d2f4e6a13f3e6c10484fb5dbc4e8be6576c6

I'll incorporate it, and the content of this subthread, in the RFC when I
get my next free five minutes. :)

In fact it would come in very handy for extended tests of a bugfix I
> have in the pipeline.
>

I'm not sure how to get the query with the $1. My understanding of
pdo_pgsql/pgsql_stmt_execute() is that it creates some PG-specific data
structures for prepared statements. Since they're attached to
a pdo_pgsql_stmt value, you'd have to write some driver-specific code to
get them out.

Maybe there's a simple way to do what you're describing, but my instinct is
that it would be better to keep it out-of-scope for this RFC.

Thanks,
Adam

Reply via email to