in reply to DBI Quoting question
You just need to make sure you always have the same number of array elements in @line that you have '?' marks in $sql_fmt or DBI will give you an error.my $sql_fmt = "INSERT INTO whatever VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,? +)"; while (<INFILE>) { my @line = (parse_csv ($_)); $dbh->do($sql_fmt,undef,@line); }
Also it's a good idea to format your SQL statements like: INSERT INTO whatever (column_names) VALUES(?...) That way all your insert statements won't break if you decide to add to your database structure.
|
|---|