[Dbix-class] custom result source calling a stored procedure

Will Crawford billcrawford1970 at gmail.com
Tue Jun 10 11:59:03 GMT 2014


$users->search (
 [
  { 'user_friends.user_id' => $id },
  { 'user_friends.friend_user_id' => $id }
 ], {
  join => 'user_friends'
 }
)->all



On 10 June 2014 12:18, Mitchell Elutovich <melutovich at gmail.com> wrote:
> For a customer result source, I know we can do something such as:
>
> $new_source->name( \<<SQL );
>   ( SELECT u.* FROM user u
>   INNER JOIN user_friends f ON u.id = f.user_id
>   WHERE f.friend_user_id = ?
>   UNION
>   SELECT u.* FROM user u
>   INNER JOIN user_friends f ON u.id = f.friend_user_id
>   WHERE f.user_id = ? )
>   SQL
>
> is there any restrictions on the SQL; is it possible to have the SQL just be
> a call to a stored procedure?
>
> _______________________________________________
> 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/dbix-class@lists.scsys.co.uk



More information about the DBIx-Class mailing list