Just another Perl shrine | |
PerlMonks |
RE: DBI Quoting questionby Anonymous Monk |
on May 10, 2000 at 23:04 UTC ( [id://11032]=note: print w/replies, xml ) | Need Help?? |
my $sql_fmt = "INSERT INTO whatever VALUES( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)";
while (<INFILE>) {
my @line = (parse_csv ($_));
my $sql = sprintf ($sql_fmt, map {$dbh->quote($_)} @line); #Elements of @line need to be in quotes
$dbh->do($sql);
}
In Section
Seekers of Perl Wisdom
|
|