On Wed, May 12, 2010 at 9:48 AM, Peter Rabbitson
<[email protected]<rabbit%[email protected]>
> wrote:

> > So, my question is should (or can??) DBIC add the alias to the "id" in
> > the WHERE?  The problem, of course, is if there's a join with another
> > table that also has an "id" column.
>
> No. You qualify yourself as DBIC can not possibly know what you meant.
>

Ok, I was not clear how DBIC manages search conditions.


DBIC does know to prefix the columns, so I was curious if also possible with
the search conditions.  I guess not.

  $col = join( '.', $current_source_alias, $col ) if $col !~ m{\.} &&
$self->has_column( $col )



> >     my %criteria = ( 'me.' . $primary_keys[0] => $id );
>
> This is totally wrong. This is *exactly* what current_source_alias is
> for. You should use it in place of 'me'
>

Yes, but what I was trying to explain is that at the time the above code is
run the alias does not exist -- that's even before a resultset has been
created so there's no current_source_alias.

But, there's easy work arounds, yes.  Thanks for your replies.

-- 
Bill Moseley
[email protected]
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to