[Dbix-class] Dummy DBIC columns?

Bill Moseley moseley at hank.org
Tue May 17 14:22:07 GMT 2011


On Mon, May 16, 2011 at 10:31 PM, Octavian Rasnita <orasnita at gmail.com>wrot=
e:

>  *From:* Bill Moseley <moseley at hank.org>
>
>
>
> I have two databases that are very similar.  For example, the "person"
> table in one db has an "email" column and the other does not have that
> column, otherwise the tables are the same.
>
> My application uses the schema with the table that has the "email" column,
> so there's places in the application that call $person->get_column( 'emai=
l'
> ), and also $person_rs->create( { name =3D> $name, email =3D> $email } );
>
> Now, I want to use the second schema with the same application, but as
> mentioned above does not have an "email" column on the person table.  it's
> not important that the column does not exist.
>
> My question is what can I do to make get_column and create (and other
> methods that assume there is an "email" column) work without this column
> defined in the result class.  Is there any way to have define a column th=
at
> is never used when constructing database queries?
>
>
>
> Hi,
>
> Use in the Result class:
>
> __PACKAGE__->mk_group_accessors( simple =3D> 'email' );
>
> No.  Although that makes an accessor (just as my "sub email {}" example
would provide) it doesn't register a column so ->get_column and ->create
will still fail.



-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20110517/ac7=
1a811/attachment.htm


More information about the DBIx-Class mailing list