dbd::csv with col_names but insert / delete / update fail
- From: access_you@xxxxxxxxx (Aclhkaclhk)
- Date: Mon, 31 Dec 2007 00:52:52 -0800 (PST)
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)");
.
- Follow-Ups:
- Re: dbd::csv with col_names but insert / delete / update fail
- From: Jeff Zucker
- Re: dbd::csv with col_names but insert / delete / update fail
- Prev by Date: RE: Can't locate DBD/Oracle.pm after DBD Oracle 1.19 installation
- Next by Date: Re: dbd::csv with col_names but insert / delete / update fail
- Previous by thread: ORACLE DRIVER
- Next by thread: Re: dbd::csv with col_names but insert / delete / update fail
- Index(es):
Relevant Pages
|