Good day monks. It seems like I have stumbled with the bug described in here:
http://rt.cpan.org/Public/Bug/Display.html?id=13080
Just that it appears to affect arithmetic operations in general. According to CPAN I am using the latest version of SQL::Statement, v 1.15 . It seems like the bug has a fix available, a patch is on the on the bug report page, although for v 1.14, and also I'm not familiar with patching and editing modules, yet. So I am asking for your help. I assembled a small script, based on the bug report one but capable of testing more SQL Statements.
use DBI; use strict; my $db = DBI->connect(qq/DBI:CSV:/); eval{$db->do('CREATE TABLE bug (a int, b int)')}; $db->do("INSERT INTO bug VALUES(0, 0)"); $db->do("update bug set a = 1"); eval{$db->do("update bug set b = 1 + 1")}; eval{$db->do("update bug set b = 1 - 1")}; eval{$db->do("update bug set b = 1 * 1")}; eval{$db->do("update bug set b = 1 / 1")};
When I run it I get this output:
DBD::CSV::db do failed: Can't use an undefined value as an ARRAY refer +ence at /usr/lib/perl5/site_perl/5.10/SQL/Statement.pm line 1777, <GE +N2> line 2. [for Statement "update bug set b = 1 + 1"] at /cygdrive/c/Users/Profe +sional/perl/databases/bug.pl line 9. DBD::CSV::db do failed: Can't use an undefined value as an ARRAY refer +ence at /usr/lib/perl5/site_perl/5.10/SQL/Statement.pm line 1777, <GE +N3> line 2. [for Statement "update bug set b = 1 - 1"] at /cygdrive/c/Users/Profe +sional/perl/databases/bug.pl line 10. DBD::CSV::db do failed: Can't use an undefined value as an ARRAY refer +ence at /usr/lib/perl5/site_perl/5.10/SQL/Statement.pm line 1777, <GE +N4> line 2. [for Statement "update bug set b = 1 * 1"] at /cygdrive/c/Users/Profe +sional/perl/databases/bug.pl line 11. DBD::CSV::db do failed: Can't use an undefined value as an ARRAY refer +ence at /usr/lib/perl5/site_perl/5.10/SQL/Statement.pm line 1777, <GE +N5> line 2. [for Statement "update bug set b = 1 / 1"] at /cygdrive/c/Users/Profe +sional/perl/databases/bug.pl line 12.
The system is Cygwin installed on Windows Vista, using Perl 5.10

In reply to Old bug with SQL::Statement by AV-2

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.