trouble with stringify

[prev] [thread] [next] [Date index for 2005/04/24]

From: merlyn (Randal L. Schwartz)
Subject: trouble with stringify
Date: 23:56 on 24 Apr 2005
I have (essentially):

  Role->columns(Primary => qw(film actor));
  Role->columns(All => qw(film person role_title));
  Role->has_a(film => 'Film');
  Role->has_a(person => 'Person');

  Film->columns(Primary => /film_id/);
  Film->columns(Stringify => /film_name/);

  Person->columns(Primary => /person_id/);
  Person->columns(Stringify => /person_name/);

I've had cases where I am holding a $role that hasn't been entire
fleshed out, and then I stringify the $film or $person (for display).
And when I go back to get $role->role_title, it blows up.  The SQL
shows me that it's trying to use the *stringified* versions of the
$film and $person to perform another retrieve of the additional column
of $role.

My workaround is 

  Role->columns(Essential => qw(film person role_title));

but why is it breaking this way?

I know you're not supposed to have a has_a on your primary key,
because the inflation there will throw it off.

But I've never seen any admonition not to stringify a column of your
primary key.  Is this also broken for the same reasons?  If so, can
the docs be fixed?  If not, can the code be fixed?

        -- 
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@xxxxxxxxxx.xxx> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

(message missing)

trouble with stringify
merlyn (Randal L. Schwartz) 23:56 on 24 Apr 2005

Re: trouble with stringify
Perrin Harkins 01:09 on 25 Apr 2005

Re: trouble with stringify
merlyn (Randal L. Schwartz) 04:53 on 25 Apr 2005

Re: trouble with stringify
Perrin Harkins 05:10 on 25 Apr 2005

Re: trouble with stringify
merlyn (Randal L. Schwartz) 05:15 on 25 Apr 2005

Re: trouble with stringify
Perrin Harkins 05:24 on 25 Apr 2005

Re: trouble with stringify
merlyn (Randal L. Schwartz) 05:26 on 25 Apr 2005

Re: trouble with stringify
Tony Bowden 08:46 on 25 Apr 2005

Generated at 09:29 on 27 Apr 2005 by mariachi v0.52