Sterin, Ilya writes:
> True, I wonder if that would greatly benefit DBI, I can't see a case where
> it would prove better than threading/forking. It would still fork
> internally in the DBD though, right?
No - it'd use non-blocking IO to communicate with the server. The
Sybase OC libs can do this either using a polling model (send the
request, and then poll at intervals to see if there is anything to be
processed (sort of like select())), or via a notification model
(register a notification callback, which gets called when an async
request completes).
Meanwhile the main code line can do other things.
I haven't felt the need to use this up to now, but I may add this to
the Sybase::CTlib module for the next release.
Michael
> -----Original Message-----
> From: Michael Peppler
> To: [EMAIL PROTECTED]
> Sent: 8/9/01 10:47 AM
> Subject: RE: background sql queries
>
> Sterin, Ilya writes:
> > Well that's called forking. Weather you implement yourself, or DBD's
> > implement for you, you still must fork or spawn a thread in order to
> do
> > anything while the processing in progress.
>
> Actually you could do that if DBI (and the driver) supported
> asynchronous calls...
>
> Michael
>
>
> > -----Original Message-----
> > From: Giotto De Filippi
> > To: Sterin, Ilya; '[EMAIL PROTECTED] '
> > Sent: 8/9/01 8:22 AM
> > Subject: RE: background sql queries
> >
> > No, I do not mean forking.
> >
> > I want my program to be single threaded. What I want would be
> somehting
> > like:
> >
> > $qh = $dbh->prepare("blabla");
> > $qh->execute;
> >
> > while (!$qh->is_ready)
> > {
> > print "SQL is busy processing your query, please wait...\n";
> > }
> >
> > @results = $qh->fetchrow_array;
> >
> > thanx for your help
> >
> > At 08:16 AM 8/9/2001 -0600, Sterin, Ilya wrote:
> > >You mean forking??? You can do anything in the background by
> creating
> > >another process with fork(). You can also use Thread, though I
> don't
> > know
> > >how stable it is as of now.
> > >
> > >Also note that you will not achieve parallel processing unless you
> are
> > on a
> > >multi-processor system, but that's irrelevant to the simple task you
> > are
> > >trying to accomplish.
> > >
> > >Ilya
> > >
> > >-----Original Message-----
> > >From: Giotto De Filippi
> > >To: [EMAIL PROTECTED]
> > >Sent: 8/9/01 7:43 AM
> > >Subject: background sql queries
> > >
> > >(Sorry, may be a double post but I don't know if the other message
> went
> > >throught as I was still not registered)
> > >
> > >Hello,
> > >
> > >Can I do SQL background queries with DBI?
> > >
> > >like instead of doing ->prepare, ->execute and ->fetchrow_hashref
> > >something
> > >like ->is_ready, to do before fetchrow, so for example I could do
> other
> > >things with my perl program while it's waiting for the sql databsae
> to
> > >return the result.
> > >
> > >Thanx much
> > >
> > >Giotto
> > >
> > >
> > >
> > >----------------------------------------------
> > >Giotto De Filippi
> > >Web Marketer / Programmer
> > >E - Mail: [EMAIL PROTECTED]
> > >ICQ: 17988776
> > >----------------------------------------------
> >
> > ----------------------------------------------
> > Giotto De Filippi
> > Web Marketer / Programmer
> > E - Mail: [EMAIL PROTECTED]
> > ICQ: 17988776
> > ----------------------------------------------
>
> --
> Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
> [EMAIL PROTECTED] - [EMAIL PROTECTED]
> International Sybase User Group - http://www.isug.com
--
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
[EMAIL PROTECTED] - [EMAIL PROTECTED]
International Sybase User Group - http://www.isug.com