more on inherited classes
[prev]
[thread]
[next]
[Date index for 2004/07/27]
Further testing and investigation.
I back-leveled the DBD::Pg to the current CPAN version (and modified
everything that was asking for magic scalars and so on so that it all
runs).
I get the same behavior: create and retrieve return a hash with only
subject_id, the primary key.
I looked into this and found that in Class::DBI::_create
everything was getting tossed out and I don't understand why.
Temp columns yes I could see maybe. But the contents of $real?
Leaving me with only my primary key fields? Why?
Here is the code in question from line 599 ff:
@primary_columns{@primary_columns} = ();
my @discard_columns = grep !exists $primary_columns{$_}, keys %$real;
$self->call_trigger('create', discard_columns => \@discard_columns); # XXX
# Empty everything back out again!
$self->_attribute_delete(@discard_columns);
this did not answer the question of why retrieve didn't give me
my data. I traced in there and found more puzzling things.
For one thing, my inheritance stuff is not working right.
Before we even get to the object layer , the query generated
in Ima::DBI::_mk_sql_closure (line 381ff, see $sql at 390)
only includes columns from the current, child, class.
The provided $statement parameter is
SELECT __ESSENTIAL__
FROM __TABLE__
WHERE %s
But there are columns in the parent class which are marked Essential
that are not included.
Looking at what -is- included in the query , I see that the data for those
columns is correctly retrieved from the database .
Tracing it all the way through I see that retrieve is doing things right
up until we get to the LiveObjects logic. There it finds that the object
(which has been gutted as shown above) is in its index and just returns
that.
So the problem in retrieve is that its returning the object from create.
Altering my test script to omit the create, I get back the 'Essential'
columns of the child class.
Problem 1: the Essential columns of the parent are not included in the
query
Problem 2: _create guts the created object leaving only the primary key
behind .
|
more on inherited classes
Dana Hudes 22:33 on 27 Jul 2004
|