Hello Monks,
I'm having a problem using DBI:CSV.
Assuming the existence of a file ./test_db which looks like
f1,f2,f3,f4,f5
Can someone explain to me why the following code works
#!/usr/bin/perl
use DBI;
my $dbh = DBI->connect("DBI:CSV:")
or die "Can't connect: " . $DBI::errstr;
my @fields = qw(one two three four five);
$dbh->do("INSERT INTO test_db VALUES(?,?,?,?,?)",undef,one, two, three, four, five);
$dbh->disconnect;
## End code
Yet the following doesn't
#!/usr/bin/perl
use DBI;
my $dbh = DBI->connect("DBI:CSV:")
or die "Can't connect: " . $DBI::errstr;
my @fields = qw(one two three four five);
my $sql=qq`"INSERT INTO test_db VALUES (?,?,?,?,?)"` . ",undef," . join( ',' ,@fields);
$dbh->do($sql);
$dbh->disconnect;
## End code
This fails with the error
DBD::CSV::db do failed: Parse error near "INSERT INTO test_db VALUES (?,?,?,?,?)",undef,one,two,three,four,five at /usr/lib/perl5/site_perl/5.005/DBD/File.pm line 164.
Thank you in advance.
Todd
</body>
</html>
In reply to DBI:CSV problem by todd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |