Proper handling of connections in subprocesses

Joachim Schrod <[email protected]>
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
Hello,

I'm new to this mailing list, so I don't know if this is a FAQ; but
haven't found an answer via Google or Gmane search.

What is the proper way to handle DBD::Pg database connections in
subprocesses?
I have a master process that has a connection open (and changes the
database). The subprocesses need to access the database as well.

I understand that I have to set the master's connection $dbh
attribute InactiveDestroy to true in the child processes, to
prevent them disconnecting the master connection.

My first question is: Before I do so, can I use $dbh->clone() to
create a new connection for the child process, or should I issue a
new connect() statement for that?
If both works, are there any advantages or disadvantages that I
should be aware of?

My second issue: AFAIU, setting InactiveDestroy is only needed for
subprocesses that exit() or die(). If I have a fork/exec combo, I
don't need that, do I? (Well, maybe for the case that exec won't
succeed and the subprocess dies for that reason?)

Thanks in advance for any answer,

	Joachim

PS: I tried to post via gmane, but that doesn't work as gmane uses 
the [email protected] list. I hope that the email 
doesn't appear twice.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod				Email: [email protected]
Roedermark, Germany
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.