Re: using callbacks with connect_cached

Vincent Veyron <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
Le samedi 24 août 2013 à 21:01 +0200, David E. Wheeler a écrit :
> On Aug 24, 2013, at 1:32 AM, Vincent Veyron <[email protected]> wrote:
> 
> >> Pretty sure the connected callback will work, too.
> > 
> > It certainly does, I've checked, but this callback would add a query to
> > each connection. 
> 
> Is that not what you want?

Hi David,

Not quite : I thought connected_cache.new would enable me to set the
correct datestyle once for a cached connection, and then be cached with
it, but we've seen that won't work.

Using the connected callback would do a 'set datestyle to xyz' for each
connection, even if cached. I realize it's no big deal (.5ms on my lowly
Atom processor), but every little bit helps, as I'm sure you know. 

So I now set the datestyle when the user logs in (hence once, with
$dbh->do('SET datestyle TO xyz'), and the database handle is cached and
reused as is.

-- 
Salutations, Vincent Veyron 
http://marica.fr/ 
Gestion des contrats, des contentieux juridiques et des sinistres
d'assurance
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.