Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: DBI Quoting question

by plaid (Chaplain)
on May 10, 2000 at 20:46 UTC ( [id://11003]=note: print w/replies, xml ) Need Help??


in reply to DBI Quoting question

The best is to use the prepare method with placeholders:
my $sth = $dbh->prepare("INSERT INTO whatever VALUES(?, ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, ?, ?, ?)") while (<INFILE>) { my @line = (parse_csv ($_)); $sth->execute(@line); }
This has the benefit of taking care of the quoting for you, but also of adding a performance increase, as just having to prepare the query once will save some time, as opposed to the DBI 'do' subroutine, which has to prepare it each time.

Log In?
Username:
Password:

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

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

    No recent polls found