[Dbix-class] Dummy DBIC columns?

Bill Moseley moseley at hank.org
Tue May 17 15:14:55 GMT 2011


On Tue, May 17, 2011 at 7:43 AM, Peter Edwards <peter at dragonstaff.co.uk>wro=
te:

> Can you say
>
> my $search_attr =3D {
>   '+columns'  =3D> [ { 'email' =3D> \'' } ], # and so on for other missing
> fields
> };
>
> then
>
> my $rs =3D $schema->search_rs( $query, $search_attr );
>

Hi Peter,

Maybe I'm not understanding your suggestion.  The problem I have is an
existing application that uses DBIC, and (perhaps incorrectly) there's quite
a few direct uses of $user->get_column( 'email' ),  I could probably replace
those in the app by adding, for example, an "email" method to the result
class.   There's also other uses of the "email" column such as create() and
maybe other resultset methods that verify that every key in the passed in
data is an actual column.

I suspect replacing the get_column() usage is necessary.  But, I'm not sure
how best to deal with any other methods that might reference a non-existent
column.

Really, what I need to do is prevent the column from ending up in SQL.  So,
could I defined the non-existent column in the result class and then
override the SQL generation somewhere to strip out the columns?  I suspect
that's less that trivial.

Other option would be to override insert and create and strip out the
non-existent columns.

Unfortunately, I can't just add the columns to the database.

Any other ideas?

Thanks,



-- =

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


More information about the DBIx-Class mailing list