On Fri, April 6, 2007 01:42, John Mudd wrote:
> I think I have a fix.  Let me know what you think.
>
> In prepared_statement.hxx I switched m_statement from reference to
> regular variable.

Absolutely!  That's the trick.  I wrote that code in order to allow
"x(y)(z)" syntax, but at the time it didn't occur to me that people might
want to spread that out over multiple statements.  I probably intended to
make that impossible.

So what happens is that the string holding your statement name is already
out of scope when you start passing/defining parameters.  Normally you'd
expect to get a bad pointer dereference in that situation, but in this
case your new string containing the parameter value happened to occupy the
same stack slot or register that previously held the statement's name.

Well done, and thanks.  I'm running a test now, and will commit in a few
minutes.


Jeroen


_______________________________________________
Libpqxx-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to