Stenyj has asked for the wisdom of the Perl Monks concerning the following question:
"field1";"field2";"field3";"field4";"field5";"field6";"field7"; "5/7/2005 6:50:43 AM";1;1;0;"some text 1";"some text 5";"some text 9." "5/7/2005 5:55:44 AM";1;1;0;"some text 2";"some text 6";"some text 10" "5/7/2005 5:20:03 AM";1;1;0;"some text 3";"some text 7";"some text 11" "5/7/2005 5:06:07 AM";1;1;0;"some text 4";"some text 8";"some text 12"
my $dbh = DBI->connect(qq{DBI:CSV:csv_sep_char=\\;}); $dbh->{'csv_tables'}->{'info'} = { 'file' => 'test.csv' } or die "Prob +lem creating table"; my $sth = $dbh->prepare("select * from info") or die "Can't prepare st +h: $dbh->errstr\n"; $sth->execute or die "Can't execute the query: $sth->errstr"; my $count = 0; while (my @row = $sth->fetchrow_array) { print "Row: $count "; print $row[0] . " "; print $row[1] . " "; print $row[2] . " "; print $row[3] . " "; print $row[4] . " "; print $row[5] . " "; print $row[6] . " "; $count++; } $sth->finish;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBD::CSV - missing first row?
by hossman (Prior) on May 07, 2005 at 06:22 UTC | |
|
Re: DBD::CSV - missing first row?
by Tanktalus (Canon) on May 07, 2005 at 14:10 UTC | |
by Stenyj (Beadle) on May 08, 2005 at 06:12 UTC | |
by holli (Abbot) on May 08, 2005 at 06:36 UTC | |
by Stenyj (Beadle) on May 08, 2005 at 07:33 UTC | |
by holli (Abbot) on May 08, 2005 at 07:38 UTC | |
|
Re: DBD::CSV - missing first row?
by jZed (Prior) on May 09, 2005 at 00:37 UTC |