Lionel MARTIN wrote: > OK Fine. > > But will this be compatible with Apache::DBI?
Yes absolutely. What you are trying to do is re-invent some of the existing functionality of both Apache::DBI and DBI. DBI can cache prepared statements so you don't have to prepare them everytime and Apache::DBI can pool those statements' connections so you don't have to re-create them everytime. In a mod_perl environment you should almost always be using prepare_cached(). Trying to cache database handles and statement handlers yourself is dangerous and error prone. > Moreover, I would be happy to have a reply to my original question, at > least for the sake of knowledge. I believe others have already responded to your original question. Was their response not adequate? I am wondering if it is possible, at different times during the server life, that Apache::DBI returns twice the same memory reference, while the connection is in fact physically not the same. DB handles aren't shared between processes so if you're comparing 2 different live objects and their addresses are the same then they are the same object. If you store the address of the one object and then a long time later compare a different object to that original address and it turns out to be the same I don't think you can definitively say they are the same. I can imagine the unlikely scenario where the first one has been reclaimed by Perl's GC and then a 2nd object was created in the now unused space with the exact address. This is why you need to use Apache::DBI which doesn't cache based on address but on connection parameters. It also does things like pinging the mysql server to make sure the connection's still valid and reconnecting if necessary. If you start caching your own statement handlers you'd have to re-implement all of that. -- Michael Peters Developer Plus Three, LP