If you have a lot of result rows that you're expecting, assigning the whole
set to an array might cause memory troubles.

I'd recommend the _rs approach for processing one at a time:

my $rs = $schema
    ->resultset('Mytable')
        ->*search_rs*( # note _rs suffix, instead of ->all
            { item_id => $id },
        );
while ( my $item = $rs->next ) {
    # do useful things with $item and $item->item_status
}


On Wed, May 15, 2013 at 10:59 PM, Rajeev Prasad <rp.ne...@yahoo.com> wrote:

> from here  i understood, that if i collect output in array element, i will
> get an array.
> http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/ResultSet.pm#search
>
> in below, $id is unique in the table, so it returns just one row.
>
> my @item_array = $schema->resultset('Mytable')->search(
>         { item_id => $id },
>         { select   => [qw/item_status/] }
>         );
> print "print array =@item_array\n";
>
>
>  ./test.pl
> node status=Db::Schema::Result::Mytable=HASH(0x17b9cf8)
> $
>
>
> I actually/finally  want to get the value of an specific column by
> supplying $id. not sure how to get that.
>
> _______________________________________________
> 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
>



-- 
 Will Trillich :: 812.454.6431

“Grading takes away all the fun from failing. And a huge part of education
is about failure.”  -- Shimon Schocken
_______________________________________________
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