Issac Goldstand wrote:
I'm not sure what's the Apache2::DBI question, but we (Tim, Hugo, Eric at el.) have discussed the Apache::DBI for threaded apps at the last TPC and the conclusion was that we need to write a generic Perl Thread::DBI module to work with threaded Perl and then use Apache::DBI on top of it.This is really a C API thing, but I was wondering if Apache2::DBI people can help me shed some light on this...
Some of this was discussed on the dbi-dev list, but as far as I know nothing was developed so far. If you want to discuss the design, which is not trivial, and implementation, it's probably the best to do that on the dbi-dev list.
----- Original Message ----- From: "Kent Fitch" To: <[EMAIL PROTECTED]> Sent: Monday, November 18, 2002 5:37 AM Subject: Re: [apache-modules] Persistant MySQL connections in Apache 2Hi Issac, From: "Issac Goldstand" Subject: [apache-modules] Persistant MySQL connections in Apache 2Hi all, I'm a rookie C API programmer (mod_perl was just so much *easier*most ofthe time :-)), and am working on coding a module to with in myfront-endApache 2/mod_proxy server. The idea of the module is to provideaccess tothe front-end server with a list of "blacklisted" IPs which are storedin aMySQL database. So I'm thinking the module's child_init should opentheconnection to the MySQL database and then the access_handler can grabtheMySQL connection from the child-pool.Yes, but beware that in a threaded Apache run-time, there could be many threads fo execution processing many requests "simultaneously" in your child process, so you'll have to arrange to lock the connection whilst a thread is using it and possibly have a pool of them. See "Thread Safety" http://httpd.apache.org/docs-2.0/developer/thread_safety.htmlBut the problem is that I would *like* for the connections to thedatabasebe closed before the pool is simply swept clean upon destruction. Iwouldthink that that would be a "good thing to do" - maybe I'm wrong...Yes - you should register a cleanup function on the pool you allocate the data structures for the connection(s) from in your "init". See these notes on pooling (which may be a bit 1.3-ish and hence out of date, but the ideas are relevant): http://httpd.apache.org/docs-2.0/developer/API.html#pools and see the apr_pool_cleanup_register api Kent Fitch
-- _____________________________________________________________________ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/