Tongue planted frimly in cheek....ok, so do this:
$qh = $dbh->prepare("blabla");
print "SQL is busy processing your query, please wait ...\n";
$qh->execute;
@results = $qh->fetchrow_array;
print "... Processing complete.\n";
The whole point of this is that TIMTOWTDI, but if you actually want to be
*performing an action* while the query is processing, then as Uncle Ilya
says: You must fork.
BTW, did anybody else notice that he wanted to make the "please wait"
message scroll like mad?
Sterin, Ilya" wrote:
> Yes but this message will not show during execute fase, but rather
> afterwards.
>
> Ilya
>
> -----Original Message-----
> From: Maria Quinn
> To: dbi-users
> Sent: 8/9/01 9:19 AM
> Subject: RE: background sql queries
>
> What you are trying to do looks suspiciously concurrent. How about a
> simpler
> solution:
>
> ############## snip##
> $qh = $dbh->prepare("blabla");
> $qh->execute;
>
> print "SQL is busy processing your query, please wait ...\n";
>
> @results = $qh->fetchrow_array;
>
> print "... Processing complete.\n";
> ############## snip ##
>
> Not very grand, I know, but it kind of does what you want. Even if your
>
> solution was possible, it would slow your query down even more.
>
> Maria
>
> On Thu, 9 Aug 2001, Giotto De Filippi wrote:
>
> > 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
> > ----------------------------------------------
> >
> >