Red Neckerson has asked for the wisdom of the Perl Monks concerning the following question:
I would like to delete all of them with one Select and prepare statement, in "one fell swooop" if I can. My first reaction was to use a while loop like this:
while $i (@MESSAGE_IDS){ my $sth = $dbh->prepare("DELETE * FROM table WHERE message_id = '$message_id'"); $sth->execute(); # and so on ... }
But apparently calling prepare and execute over and over is not a good way of deleting multiple rows. Is there a better dbi function or function to accomplish what I want without calling prepare and execute in a loop? Red------
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Deleting Multiple MySQL Rows With DBI
by lhoward (Vicar) on May 22, 2001 at 23:27 UTC | |
by runrig (Abbot) on May 22, 2001 at 23:43 UTC | |
by lhoward (Vicar) on May 23, 2001 at 00:15 UTC | |
by Red Neckerson (Novice) on May 23, 2001 at 03:42 UTC | |
|
Re: Deleting Multiple MySQL Rows With DBI
by Beatnik (Parson) on May 22, 2001 at 23:34 UTC | |
|
Re: Deleting Multiple MySQL Rows With DBI
by mr.nick (Chaplain) on May 22, 2001 at 23:28 UTC | |
|
Re: Deleting Multiple MySQL Rows With DBI
by runrig (Abbot) on May 22, 2001 at 23:29 UTC | |
|
Re: Deleting Multiple MySQL Rows With DBI
by Hero Zzyzzx (Curate) on May 22, 2001 at 23:45 UTC | |
|
Re: Deleting Multiple MySQL Rows With DBI
by Odud (Pilgrim) on May 22, 2001 at 23:42 UTC | |
|
(dkubb) Re: (2) Deleting Multiple MySQL Rows With DBI
by dkubb (Deacon) on May 24, 2001 at 05:35 UTC |