This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
To: dbi-users@perl.org From: Rick Edwards <ricke@mjr.com> Subject: Re: First record only with DBD::CSV Date: Thu, 19 Jul 2001 12:03:40 -0400 On Thursday 19 July 2001 11:50 am, you wrote: > I'm using DBD::CSV v0.1027 with DBI v1.18 and perl 5.6.1 on RedHat Linux > and it seems as though DBD::CSV only fully processes files saved in DOS > format(?!). If I save them in UNIX format only the first row makes it into > each of the tables. > > Is this deliberate? The default value for the eol is '\r\n' which is the EOL in DOS. You can set up your connection like this: my $dbh = DBI->connect("DBI:CSV:") or die "Cannot connect to CSV database: $DBI::erstr\n";; my $columnNames = [ qw( Column1 Column2 Column3 Column4 Column5 ) ]; $dbh->{'csv_tables'}->{my_table} = { 'eol' => "\n" 'file' => "my_table.csv", 'col_names' => $columnNames }; Rick === To: dbi-users@perl.org From: Rick Edwards <ricke@mjr.com> Subject: Re: First record only with DBD::CSV Date: Thu, 19 Jul 2001 12:25:53 -0400 Oops, I forgot to add 'skip_rows' to that last bit. $dbh->{'csv_tables'}->{my_table} = { 'eol' => "\n" 'file' => "my_table.csv", 'skip_rows' => 0, 'col_names' => $columnNames }; It also assumes that the first row of the data file *does not* contain the column names. If your file does then leave off the 'skip_rows' and 'col_names' bits. ===