Esteemed Brethren,
We've come across a strange problem with DBD::CSV when inserting / updating empty fields, demonstrated by this test case.
use DBI;use strict;use warnings; my $dbh = DBI->connect("DBI:CSV:f_dir=./;"); $dbh->do("create table mytable (field1 text,field2 text)"); $dbh->do("insert into mytable values ('','there')"); print "field1=",$dbh->selectrow_array("select field1 from mytable");
which prints field1='?0?there' only on our Redhat 7.3.2 (Perl 5.8,DBD::CSV 0.2002) box - not on the Windows machines (also Perl 5.8, DBD::CSV 2.002) or a Debian Perl 5.6 (DBD::CSV 1.030) machine.

I therefore assumed it was something to do with Text::CSV_XS, but that seems to be fine as far as I can make out - this is OK...

use Text::CSV_XS; use IO::Wrap; my $csv = Text::CSV_XS->new(); my $fh = wraphandle(STDOUT); $csv->print($fh, ['','test']);
...and it looks like could be something to do with placeholders - values('','something','','something'...) gives '?0?something','?1?something' etc.

Stangely also, even if csv_quote_char is set to \", the values are always single-quoted.

Has anybody else come across this? I'm not seriously worried, as we're only playing with CSV for initial prototyping fun, but it seemed a curious bug. I don't want to go mailing authors unless it's reproducible elsewhere, and not just us being dumb :)

Cheers,Ben.


In reply to DBD::CSV empty fields problem on RedHat / Perl 5.8. by benn

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.