On 11 February 2015 at 21:58, Ekki Plicht (DF4OR) <e...@plicht.de> wrote:
> Hi,
> I need to check a list of values if they exist in a database. The
> value is a unique key of that table. A stupid 'find' works of course,
> but returns the whole row data, where I only need a simple binary
> yes/no information if a row was found or not.

Presuming you mean that you need to get a list of them all, there's a
few answers, depending on your needs. A couple of the answers already
given are pretty useful and I'll be filing the "exists" rs method away
for future use.

Something like

    my %found = map +( $_ => 1 ),
        $rs->search_rs( { key => { -in => [ ... ] } } )->get_column('key')->all;

might do the trick (not tested for typos).

_______________________________________________
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

Reply via email to