in reply to mutiple threading
Hi,
I dont know why you need to execute 3 SQLs parallelly. But you can try something like this.
use threads; use DBI; my $dbh = DBI->connect( <your connection string> ); $SQL_1 = "SELECT * FROM x"; $SQL_2 = "SELECT * FROM y"; $SQL_3 = "SELECT * FROM z"; sub start_thread { my ($dbh,$SQL) = @_; # print('Thread started: ', SQL, "\n"); my $sth = $dbh->prepare($SQL); $sth->execute(); < Add your code here > } my $thr1 = threads->create('start_thread', $dbh, $SQL_1); my $thr2 = threads->create('start_thread', $dbh, $SQL_2); my $thr3 = threads->create('start_thread', $dbh, $SQL_3); $thr1->join(); $thr2->join(); $thr3->join();
For more details, refer to threads
Notes:
Cheers !
--VC
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: mutiple threading
by BrowserUk (Patriarch) on Aug 09, 2007 at 13:06 UTC | |
by atemon (Chaplain) on Aug 09, 2007 at 15:51 UTC | |
by BrowserUk (Patriarch) on Aug 09, 2007 at 16:05 UTC | |
by atemon (Chaplain) on Aug 24, 2007 at 05:01 UTC | |
by BrowserUk (Patriarch) on Aug 24, 2007 at 05:31 UTC | |
by Anonymous Monk on Sep 03, 2007 at 10:59 UTC | |
by atemon (Chaplain) on Sep 03, 2007 at 12:01 UTC |