http://search.cpan.org/~timb/DBI/DBI.pm#Threads_and_Thread_Safety
Tim.
On Thu, Mar 11, 2004 at 12:05:40PM -0500, Arnold, Hugh wrote:
>
> I want to spin off $sth->execute() & just this statement into a thread, so I
> can perform other tasks while the database is preparing the results of my
> query. Like:
> my $sth=$dbh->prepare(...);
> my $thread=async{$sth->execute()};
> ...do other stuff for a while...
> $thread->join();
> while (my $row=$sth->fetchrow_arrayref()) {...}
>
> The DBI package explicitly forbids sharing a statement handle in this way,
> although some C database interfaces will cope with it. I am using DBI 1.41,
> DBD::mysql 2.9003 & perl 5.8.2. My DBD::mysql is built against a
> thread-safe version of libmysqlclient_r.so. And this mysqlclient_r library
> doesn't mind being used in this way.
>
> Can I disable the DBI check for sharing of handles between threads? Are
> there any gotchas to doing this? Any alternative(hopefully cleaner) methods
> for backgrounding my initial $sth->execute() call?
>
> Thanks much.
>
> ------------------------------------------------------------------------------
> This message is intended only for the personal and confidential use of the
> designated recipient(s) named above. If you are not the intended recipient of
> this message you are hereby notified that any review, dissemination,
> distribution or copying of this message is strictly prohibited. This
> communication is for information purposes only and should not be regarded as
> an offer to sell or as a solicitation of an offer to buy any financial
> product, an official confirmation of any transaction, or as an official
> statement of Lehman Brothers. Email transmission cannot be guaranteed to be
> secure or error-free. Therefore, we do not represent that this information is
> complete or accurate and it should not be relied upon as such. All
> information is subject to change without notice.
>