[CDBI] Re: Class::DBI and forking
"Perrin Harkins" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
Carlos, > What if I didn't want the child to open a new connection? > In my particular case, I fork children to do some SNMP queries and pass > back the results to the parent process via unix sockets. All the DB > updates are done later in the parent process, when all children have > finished. > The way the patch works now, each child has to open a new db connection, > which ends up being unnecessary. Right? Right. > Is there any way I could have the option of reconnecting or not, > depending on the case? I don't think it will work to try to use the same database socket connection from multiple processes, even if you don't do them at the same time. I expect the database library will get confused and segfault. You can try it if you want to though. All you have to do is just not apply the patch. The normal behavior is to not create a new connection. You would also want to set InactiveDestroy in the child processes. - Perrin