Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

(dkubb) Re: (2) Deleting Multiple MySQL Rows With DBI

by dkubb (Deacon)
on May 24, 2001 at 05:35 UTC ( [id://82790]=note: print w/replies, xml ) Need Help??


in reply to Deleting Multiple MySQL Rows With DBI

Remember, you only need to prepare a statement handle if you are going to re-use it for more than 1 query. Otherwise, you can use the Database Handle Methods for one-time queries. They encapsulate a prepare, execute, and sometimes a fetch-type method in a single call. For INSERT or UPDATE statements use DBI::do.

The following statement does a batch DELETE without using any 'Synthetic' Code, and is tested to work with MySQL:

$dbh->do( sprintf( 'DELETE FROM table WHERE message_id IN(%s)', join ',', ('?') x @MESSAGE_IDS ), {}, @MESSAGE_IDS, );

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://82790]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-16 22:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found