dbd::csv with col_names but insert / delete / update fail



I have a csv file. I defined the column names inside the perl script
but "sql insert" does not work. If the csv has column names, the
script (without col names defined) works.

sql select works on both csv with or without column names.

***** not working ****
/root/csv/db/b
1,peter
2,wilson

insert.pl
use DBI;
$dbh = DBI->connect("DBI:CSV:f_dir=/root/csv/
db;csv_sep_char=",";csv_quote_char=;csv_eol=\n")
or die "Cannot connect: " . $DBI::errstr;
$dbh->{'csv_tables'}->{'passwd'} = {'col_names' => ["id","passwd"]};
$dbh->do("insert into b (id, passwd) values (10,3333)");

[root@localhost csv]# perl insert.pl

Execution ERROR: No such column 'B.ID' called from insert.pl at 6.

***** working without error*******
id,passwd
1,peter
2,wilson

insert.pl
use DBI;
$dbh = DBI->connect("DBI:CSV:f_dir=/root/csv/
db;csv_sep_char=",";csv_quote_char=;csv_eol=\n")
or die "Cannot connect: " . $DBI::errstr;
$dbh->do("insert into b (id, passwd) values (10,3333)");

.



Relevant Pages

  • Re: dbd::csv with col_names but insert / delete / update fail
    ... That's because you defined the column names for a table called "passwd" and then tried to do an insert on a table called "b". ... sql select works on both csv with or without column names. ... use DBI; ...
    (perl.dbi.users)
  • Excel Macro for creating bar chart
    ... I have a perl script in linux environment where i go through some files ... and generate a "csv" file as below: ... I am new to writing excel macros and am ...
    (microsoft.public.excel.programming)
  • Re: What is the logic of storing XML in a Database?
    ... will trap most major errors. ... In fact one does, XML. ... CSV is useful for unloading an SQL table into a text ...
    (comp.databases.theory)
  • Re: Importing lg csv file into Access tbl
    ... It just when I try to export the data out of the tool into .csv ... I don't know much about Oracle specifically, but what I ususally do when I ... get the query working correctly there, then copy the SQL and paste it into ...
    (microsoft.public.access.externaldata)
  • Re: How to execute a SQL select???? (successfully that is!)
    ... SQL table in Perl and use a returned column from that row in my Perl script. ... How can I find out EXACTLY what error (ie. SQL status and return codes) are resulting from the failed operation? ... for Mysql module: ... the Msql and Mysql modules are obsoleted by the DBI ...
    (comp.lang.perl.misc)