Update 2: Nevermind. After deleting a bunch of modules from /usr/lib/perl5/site_perl and reinstalling them, it now works. <sigh>

This has me a bit baffled... I suppose the best way to explain it is an example. Here is my "database", in a file called "MyTable":

COLA,COLB,VALUE foo,bar,1 baz,bar,2
And the code:
#!/usr/bin/perl use strict; use warnings; use DBI; use Data::Dumper; my $dbh = DBI->connect(qq{DBI:CSV:f_dir=.;csv_eol=\n}, undef, undef, { +RaiseError => 1}); my $sth = $dbh->prepare('SELECT VALUE FROM MyTable WHERE COLA = ? AND +COLB = ?'); $sth->execute('baz', 'bar'); my @r = $sth->fetchrow_array(); print Dumper \@r;
If I run this, I get:
$ perl ./csvtest.pl $VAR1 = [];
And yet if I change 'baz' to 'foo', I get:
$ perl ./csvtest.pl $VAR1 = [ '1' ];
In the example, I'm expecting to get a '2', but that's not what I'm getting.

Any clues?

DBD::CSV, Text::CSV_XS, SQL::Statement all seem to be at the latest available...

(Apparently, I use CSV files for databases too much :->)

Update:

$ perl -MDBI -e 'DBI->installed_versions' Perl : 5.008008 (i686-linux-thread-multi) OS : linux (2.6.16-gentoo-r12) DBI : 1.58 DBD::mysql : 4.005 DBD::Sponge : 12.008696 DBD::SQLite : 1.13 DBD::Proxy : 0.2004 DBD::Multiplex : 1.98 DBD::Gofer : 0.009560 DBD::File : 0.35 DBD::ExampleP : 12.009532 DBD::DBM : 0.03 DBD::CSV : 0.22 $ perl -MSQL::Statement -le 'print $SQL::Statement::VERSION' 1.15 $ perl -MText::CSV_XS -le 'print $Text::CSV_XS::VERSION' 0.32
(Not sure what other levels may be pertinent...)


In reply to Oddity with CSV query by Tanktalus

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.