[CDBI] Bug with sequences and the object cache ( I think )

William Ross will at spanner.org
Thu Nov 10 16:09:24 GMT 2005


On 10 Nov 2005, at 09:53, Edmund von der Burg wrote:

> On 09/11/05, Perrin Harkins <perrin at elem.com> wrote:
>> I provided a patch against Class::DBI 0.96 that fixed this, along  
>> with
>> other object index issues, back in June.  It looks like it did not  
>> get
>> put in.
>>
>> This will not work against newer versions (or without the rest of the
>> changes in the patch), but here's the relevant portion if you want to
>> adjust it for the version you use:
>>
>> @@ -569,6 +617,12 @@
>>         my @discard_columns = grep !exists $primary_columns{$_},  
>> keys %
>> $real;
>>         $self->call_trigger('create', discard_columns =>
>> \@discard_columns);   # XXX
>>
>> +       # now that we have a complete primary key, add this to the
>> object index
>> +       if ($Use_Object_Index) {
>> +               my $key = $class->_live_object_key({ $self- 
>> >_as_hash });
>> +               $class->live_object_store($self, $key);
>> +       }
>> +
>>         # Empty everything back out again!
>>         $self->_attribute_delete(@discard_columns);
>>         $self->call_trigger('after_create');
>
> Just a couple of small tweaks and this can be added to v3.0.12 leading
> to the test suite I posted passing (as well as the other tests):
>
>         # now that we have a complete primary key, add this to the
>         # object index
>         if ( $Weaken_Is_Available ) {
>           $self = $class->_init( $self );
>         }

Just by the way, I put a related bug to Tony not long ago, in which  
primary key columns are discarded if they're included in the set  
passed to update(), rendering the object unusable. Kate Yoak spotted  
it, and I see that Perrin's patch would have fixed it. He said:

> There's certainly unwanted behaviour, but I'm not sure what the  
> best way
> to go is.
>
> My inclination is to try to finish off the patch that makes the
> accessors for primary keys be read only at the Class::Accessor level.

which puts it in the slow lane, of course. This may mean that  
supplying a patch isn't going to be all it takes.

best

will





More information about the ClassDBI mailing list