Re: [CDBI] Bug with sequences and the object cache ( I think )
[prev]
[thread]
[next]
[Date index for 2005/11/09]
On Wed, 2005-11-09 at 21:39 +0000, Edmund von der Burg wrote:
> I
> believe that CDBI will read the data back from the database after
> saving it so that any changes made by the database are reflected. As
> the object is read from the database there is a primary key and so it
> should go into the index.
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');
- Perrin
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi