[Dbix-class] behavior of prior cond's in ResultSet->new_result
Mark Hedges
hedges at ucsd.edu
Wed Jul 19 01:26:38 CEST 2006
Say I create a ResultSet object with
search({ some_field => [ @possibilities ] }).
@possibilities happens to be only ( 'x' ) at the moment.
'x' doesn't happen to be in the database, but I'm lazily
populating, so I do
my $thing = $rs->find_or_create({ some_field => 'x' });
In new_result, before the foreach on $self->{cond}, %new is
right, and the entry is some_field => 'x'.
After the foreach on $self->{cond}, %new contains
some_field => ['x']
This causes the SQL to break, placing x as an unquoted scalar
instead of a ? in the VALUES part of the query.
My workaround is to get a new ResultSet before find_or_create.
Or is that what I'm "supposed to do"?
Mark
More information about the Dbix-class
mailing list