On Wed, 16 Jul 2003 09:38:52 +0100, Avis, Ed wrote:
>>>My particular application is to do an insert or update (which
>>>returns no
>>>results) in the background while my program does some CPU-
>>>intensive work
>>>in the foreground;
>
>>This can be achieved with threading (if the DBD driver supports
>>it), or
>>with forking off a child to perform the operation.
>
>That's what I do; fork a child which performs the do() call and then
>exits.
>You just have to be careful not to use the same handle while the
>child is
>using it.

Um, if you open a handle in the parent and then fork, two data structures are pointing 
to the same connection. If the parent does something, doesn't that alter the data 
which makes it
inconsistent with the data structure in the child? There lies madness AFAIC.

My rule is fork, then connect,


>
>>With Sybase::CTlib you can also use async calls to send a request
>>to the
>>db server and be notified when the process is complete. I have not
>>added
>>that to DBD::Sybase as there is no API support for this in DBI (at
>>least
>>not yet).
>
>I wasn't thinking of an asynchronous API to the database, I was just
>thinking of doing a fork or threading at the client side.
>
>But maybe the best way is to provide a do_async() method in DBI, and
>for
>DBMSes like Sybase that support asynchronous calls natively this
>could
>use the appropriate call.  For other DBMSes the DBI could simulate
>async
>access by forking (and then later calls to do() or other methods
>must first
>wait for the child process to finish).


--
Matthew O. Persico



Reply via email to