We don't bite newbies here... much | |
PerlMonks |
Class::DBI, reblessing and primary key namesby glwtta (Hermit) |
on Jan 09, 2005 at 23:48 UTC ( [id://420771]=perlquestion: print w/replies, xml ) | Need Help?? |
glwtta has asked for the wisdom of the Perl Monks concerning the following question:
Good Evening,
(I just asked this on the C:DBI list as well; those of who see both - sorry about that :) ) Seems I've just exceeded my level of knowledge of Class::DBI internals: I'm trying to rebless a retrieved C:DBI object into a subclass of its original class that adds some (non-Essential) columns, removes some columns (no problems with those two) and changes the name of the primary key (that one's a problem). I don't want to change the value of the primary key (a big no-no from what I understand), just the name. Most importantly the reblessing procedure should not hit the database at all (until the object goes to lazily fetch the new column group defined in the subclass). Is there a way to rename the column name, its accessor and mutator? I don't care if the old value is still there, as long as it doesn't try to fetch the old column on the next database trip. Another approach I am thinking of is to ->construct() the new object I want from scratch, but this requires overloading the constructors and I'd much rather do the reblessing from a 'select' trigger (seems like it'd be faster, too). Any suggestions?
Back to
Seekers of Perl Wisdom
|
|