more on inherited classes

[prev] [thread] [next] [Date index for 2004/07/27]

From: Dana Hudes
Subject: more on inherited classes
Date: 22:33 on 27 Jul 2004
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

RE: more on inherited classes
Dana Hudes 01:33 on 28 Jul 2004

Re: more on inherited classes
Charles Bailey 01:48 on 28 Jul 2004

Re: more on inherited classes
Dana Hudes 02:03 on 28 Jul 2004

Re: more on inherited classes
Tony Bowden 06:38 on 28 Jul 2004

Generated at 11:35 on 01 Dec 2004 by mariachi v0.52