Hi Guys

I am using two CSV files as DB with DBD::CSV Driver.

I used the following code to run a Select query.
------------------------- $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(); }; ----------------------
Assume the table(file 'etl') contains the following data
playercode,playername 1,Apple/iPod/iPhone 2,Leap Frog/Leapster 3,Microsoft Zune 4,Mylo
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:(

Please help me to solve this problem

Thanks in advance

In reply to DBD::CSV - Not Fetching Rows by perlmannan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.