On Sat, 07 Jul 2007 05:44:27 -0400
Tom Donovan <[EMAIL PROTECTED]> wrote:
> Nick Kew wrote:
> > On Fri, 06 Jul 2007 18:37:07 -0700
> > Matthew Kent <[EMAIL PROTECTED]> wrote:
> >
> >> think its the mysql_ping reconnection clobbering the prepared
> >> statement
> >> used in mod_authn_dbd.
> >
> > Buggrit. I can't see a satisfactory workaround for that.
> > I guess the kludge suggested by Tom Donovan in this thread
> > could be the best practical solution.
> >
>
> Alas, after some testing - it seems even that kludge won't be 100%
> satisfactory.
Heh. Anyone here have the ear of the MySQL devs?
I've just fired off a question to MySQL:
To: [EMAIL PROTECTED]
Subject: Tying actions to (re)opening a connection
The Apache DBD module maintains a dynamic pool of connections.
SQL statements may be defined at system startup. Such queries
are then treated as prepared statements. In the MySQL driver,
the sequence is:
mysql_real_connect
for each defined SQL statement {
mysql_stmt_init
mysql_stmt_prepare
}
So far, so good. However, we also need to deal with connections
that go stale. Our API defines a check_connection function.
mysql_ping is *nearly* right for this, but unfortunately leaves us
(silently) with a new connection without the prepared statements.
It would work perfectly if we could tie a callback to mysql_ping.
Something like:
int mysql_ping2(MYSQL *mysql,
int (*callback)(MYSQL*, void*),
void *dptr);
where the callback (if non-null) is invoked whenever mysql_ping
detects a stale connection and reconnects.
Is this something you'd consider adding? Any other suggestions
for a workaround to check the connection now?
--
Nick Kew
Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/