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?


In reply to Class::DBI, reblessing and primary key names by glwtta

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.