Subject: | Allow '0' As a Value in Set Clauses |
Running the following SQL query produced the error 'Incomplete SET clause!'. The problem is testing for truthness instead of definedness. With the attached patch, my operation succeeds.
UPDATE session SET lock = 0 WHERE user_id = ?
--- SQL/Parser.pm~ Tue Aug 27 08:30:56 2002
+++ SQL/Parser.pm Tue Aug 27 08:30:16 2002
@@ -601,7 +601,8 @@
my(@cols,@vals);
for(@sets) {
my($col,$val) = split / = /,$_;
- return $self->do_err('Incomplete SET clause!') if !$col or !$val;
+ return $self->do_err('Incomplete SET clause!')
+ unless defined $col and defined $val;
push @cols, $col;
push @vals, $val;
}