Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Old bug with SQL::Statement

by AV-2 (Novice)
on Feb 21, 2008 at 02:55 UTC ( [id://669178]=perlquestion: print w/replies, xml ) Need Help??

AV-2 has asked for the wisdom of the Perl Monks concerning the following question:

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

Replies are listed 'Best First'.
Re: Old bug with SQL::Statement
by andreas1234567 (Vicar) on Feb 21, 2008 at 07:23 UTC
    Bug confirmed on Linux i386, perl v5.8.5, SQL::Statement 1.15. The patch seems to resolve the issue:
    $ uname -a Linux linux 2.6.9-55.0.12.EL #1 Fri Nov 2 10:57:39 EDT 2007 i686 i686 +i386 GNU/Linux $ grep ^\$VERSION /usr/lib/perl5/site_perl/5.8.5/SQL/Statement.pm $VERSION = '1.15'; # 669178.pl is identical to source from parent node $ perl 669178.pl DBD::CSV::db do failed: Can't use an undefined value as an ARRAY refer +ence at /usr/lib/perl5/site_perl/5.8.5/SQL/Statement.pm line 1777, <G +EN3> line 2. [for Statement "update bug set b = 1 + 1"] at 669178.pl line 9. [...] $ sudo patch /usr/lib/perl5/site_perl/5.8.5/SQL/Statement.pm sql-patch patching file /usr/lib/perl5/site_perl/5.8.5/SQL/Statement.pm Hunk #1 succeeded at 1762 (offset 5 lines). $ rm bug rm: remove regular file `bug'? y $ perl 669178.pl $ cat bug a,b 1,1
    --
    Andreas
      Thank you, I needed to know how to patch it. Still, if this bug was reported for version 1.14, why wasn't it fixed on version 1.15?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://669178]
Approved by randyk
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-25 20:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found