Fellow monks,

Before reporting this to the author of the module, I'd like to run it past the collected monkish expertise, to see if I've overlooked something. I'm getting differing results from the same code when run using DBD::CSV and DBD::SQLite

I have the following test code:

use DBI; use strict; my $db = DBI->connect("DBI:CSV:"); # create table $db->do("create table testdb (NAME CHAR(20),POSTAL CHAR(20),TELEPHONE +CHAR(20))"); # create dummy data my $sth=$db->prepare("insert into testdb (NAME,POSTAL,TELEPHONE) VALUE +S (?,?,?)"); for (1..10) { $sth->execute("name $_","postal $_","telephone $_"); } # update 2 lines of data with different format statements my $sth1 = $db->prepare("update testdb set NAME=?,POSTAL=?,TELEPHONE=? + where name=?"); my $sth2= $db->prepare("update testdb set POSTAL=?,TELEPHONE=? where n +ame=?"); $sth1->execute("name 9","postaladdress","123456","name 9"); $sth2->execute("postaladdress","123456","name 10"); # display the contents of testdb my $sth3 = $db->prepare("select * from testdb"); my $result = $sth3->execute(); my $line; while ($line = $sth3->fetchrow_arrayref) { for my $attrib (@$line) { print "$attrib\t"; } print "\n"; }

(See below for output)

If I change the connect line as follows:

my $db = DBI->connect("DBI:SQLite:dbname=testfile","","");

I get a different result. This is the output using DBD::CSV

name 1 postal 1 telephone 1 name 2 postal 2 telephone 2 name 3 postal 3 telephone 3 name 4 postal 4 telephone 4 name 5 postal 5 telephone 5 name 6 postal 6 telephone 6 name 7 postal 7 telephone 7 name 8 postal 8 telephone 8 name 9 name 9 postaladdress name 10 name 10 postaladdress

and this is the output using DBD::SQLite

name 1 postal 1 telephone 1 name 2 postal 2 telephone 2 name 3 postal 3 telephone 3 name 4 postal 4 telephone 4 name 5 postal 5 telephone 5 name 6 postal 6 telephone 6 name 7 postal 7 telephone 7 name 8 postal 8 telephone 8 name 9 postaladdress 123456 name 10 postaladdress 123456

As you can see, the lines that have been changed in the DBD::CSV test are corrupt, whereas the corresponding lines in the DBD::SQLite test are correctly updated.

Am I tripping over an incorrectly formatted statement that DBD::SQLite forgives me for, and DBD::CSV doesn't, or is there a bug in DBD::CSV?

thanks,

Update: I'm running perl 5.8.7, and installed both DBD::CSV and DBD::SQLite using cpan install last night, so they should both be bang up to date.

Update:Versions:

DBD::CSV - 0.22
SQL::Statement - 1.14
DBI - 1.48
DBD::File - 0.33
Text::CSV_XS - 0.23

OS is linux

--------------------------------------------------------------

g0n, backpropagated monk


In reply to Bug in DBD::CSV? by g0n

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.