To: | cdbi-talk [...] groups.kasei.com |
From: | azb987654321 [...] hotmail.com |
Subject: | Bug. |
Date: | Wed, 3 Sep 2003 15:31:59 +0100 (BST) |
There appears to be a bug in the handling of triggers:
Create a Class::DBI object containing a field 'foo' with a 'before_set'
trigger which disallows null values, and a field 'bar' without any
triggers.
create() the object, setting both fields to valid values.
update() and dbi_commit().
Now, retrieve() the object, and set() only the field without a trigger
('bar').
The before_set_foo trigger gets called during the set() call, and fails
becuase the value of 'foo' passed to the trigger is null - i.e. the
$self->validate_column_values() call in set() does not take into account
the current values that were retrieved from the database, only the
values which were passed to the set call.
DWIM would suggest the ability to do:
my $o = O->retrieve($id);
$o->set(bar => 'new value');
to change only the value of bar (not foo). But this doesn't appear to
be allowed by the current code.