Skip Menu |

This queue is for tickets about the SQL-Statement CPAN distribution.

Report information
The Basics
Id: 13080
Status: resolved
Priority: 0/
Queue: SQL-Statement

People
Owner: Nobody in particular
Requestors: gwolf [...] debian.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.14
Fixed in: (no value)



Subject: Cannot update a field based on its previous value
SQL::Statement cannot update a field based on its previous value - That is, a simple "UPDATE table SET field = field + 1" will fail. In order to illustrate, try this snippet with DBD::CSV: #!/usr/bin/perl use DBI; my $dbh = DBI->connect("DBI:CSV:f_dir=."); $dbh->do("create table test (a int, b int, c int, d int)"); $dbh->do("insert into test values (0, 0, 0, 0)"); $dbh->do("update test set a = 1"); $dbh->do("update test set b = b + 1"); I tested it as well with DBD::Excel, with the same results: DBD::CSV::db do failed: Can't use an undefined value as an ARRAY reference at /usr/share/perl5/SQL/Statement.pm line 1772, <GEN3> line 2. [for Statement "update test set b = b + 1"] at test.pl line 7. This bug report was initially filed in the Debian bug tracking system - Please refer to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=311788 for further information.
According to the original bug submitter (in Debian), he tested against different SQL-Statement versions, and this bug appeared after 1.09.
From: ntyni [...] iki.fi
Show quoted text
> SQL::Statement cannot update a field based on its previous value - > That is, a simple "UPDATE table SET field = field + 1" will fail. In > order to illustrate, try this snippet with DBD::CSV:
Hi, the attached patch seems to fix this. It seems that SQL::Statement::get_row_value() is missing a check for 'built-in' functions like 'numeric_exp' and 'str_concat'. AFAICT, they are all lowercase while user-defined functions are uppercase. (If I'm mistaken, SQL::Statement::get_row_value() just needs to enumerate them all.) Cheers, -- Niko Tyni ntyni@iki.fi
Download sql-patch
application/octet-stream 656b

Message body not shown because it is not plain text.

Patch applied and verified.