[Dbix-class] Dummy DBIC columns?

Octavian Rasnita orasnita at gmail.com
Tue May 17 05:31:39 GMT 2011


From: Bill Moseley =





  I have two databases that are very similar.  For example, the "person" ta=
ble 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 me=
ntioned above does not have an "email" column on the person table.  it's no=
t important that the column does not exist.


  My question is what can I do to make get_column and create (and other met=
hods that assume there is an "email" column) work without this column defin=
ed in the result class.  Is there any way to have define a column that is n=
ever used when constructing database queries?




  Hi,

  Use in the Result class:

  __PACKAGE__->mk_group_accessors( simple =3D> 'email' );

  Octavian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20110517/2c9=
e6cbc/attachment.htm


More information about the DBIx-Class mailing list