On Tue, 20 May 2008 17:18:50 -0400
Matt Sergeant <[EMAIL PROTECTED]> wrote:
> On 20-May-08, at 12:33 PM, Nighthawk wrote:
>
> > Hi,
> > I am trying to write plugin that does DB lookup and want to use the
> > same db connection in more than 1 plugins.
> > Somwhere I read that we can save DB connection in qp->config(). But
> > it is not working in my case.
>
> Store it in $qp->connection->notes() in the same way you've done -
> >config.
Two small notes:
- if you use the tls plugin, all connection notes are lost after the
TLS setup is complete (we should add a hook here, so we can re-run
stuff done in the hook_connect)
[note to self: add this to the docs/plugins.pod]
- don't open the connection in hook_pre_connect (even if this works for
text notes in -async and -forkserver) you will run into trouble...
What about adding a post-fork hook for -prefork? We could open a db
connection there and just pass the open fh from $self->{_db_fh} to
a connection note.
Hanno