perlmannan has asked for the wisdom of the Perl Monks concerning the following question:
I am using two CSV files as DB with DBD::CSV Driver.
I used the following code to run a Select query.Assume the table(file 'etl') contains the following data------------------------- $dbh = DBI->connect("DBI:CSV:f_dir=/amd/homes/banni/PI/DB") or die "Cannot connect: " . $DBI::errstr; $table='etl'; $dbh->{'RaiseError'} = 1; $@ = ''; eval { $query = "SELECT playercode,playername FROM $table"; $sth = $dbh->prepare($query); $sth->execute(); $sth->execute(); while ($sth->fetchrow_arrayref()) { print("Found result row: @$_\n"); } $fields = $sth->{NUM_OF_FIELDS}; print "Fields = $fields\n"; $sth->finish(); }; ----------------------
I am able to fetch the number of fields here. But while i use $sth->fetchrow_arrayref, the rows are not fetched. Tried using fetchrow_array and fetch functions too. And the sad thing I didn't any error messages too:(playercode,playername 1,Apple/iPod/iPhone 2,Leap Frog/Leapster 3,Microsoft Zune 4,Mylo
Please help me to solve this problem
Thanks in advance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBD::CSV - Not Fetching Rows
by romandas (Pilgrim) on Feb 18, 2009 at 13:42 UTC | |
|
Re: DBD::CSV - Not Fetching Rows
by kennethk (Abbot) on Feb 18, 2009 at 14:36 UTC |