++ed by:
HANENKAMP RBUELS ZMUGHAL KENTNL PHAYLON

107 PAUSE users
105 non-PAUSE users.

David Kamholz
and 1 contributors

NAME

  DBIx::Class::ResultSetColumn - helpful methods for messing
  with a single column of the resultset

SYNOPSIS

  $rs = $schema->resultset('CD')->search({ artist => 'Tool' });
  $rs_column = $rs->get_column('year');
  $max_year = $rs_column->max; #returns latest year

DESCRIPTION

A convenience class used to perform operations on a specific column of a resultset.

METHODS

new

  my $obj = DBIx::Class::ResultSetColumn->new($rs, $column);

Creates a new resultset column object from the resultset and column passed as params

next

Arguments: none
Return Value: $value

Returns the next value of the column in the resultset (undef is there is none).

Much like $rs->next but just returning the one value

all

Arguments: none
Return Value: @values

Returns all values of the column in the resultset (undef is there are none).

Much like $rs->all but returns values rather than row objects

min

Arguments: none
Return Value: $lowest_value

Wrapper for ->func. Returns the lowest value of the column in the resultset (undef is there are none).

max

Arguments: none
Return Value: $highest_value

Wrapper for ->func. Returns the highest value of the column in the resultset (undef is there are none).

sum

Arguments: none
Return Value: $sum_of_values

Wrapper for ->func. Returns the sum of all the values in the column of the resultset. Use on varchar-like columns at your own risk.

func

Arguments: $function
Return Value: $function_return_value

Runs a query using the function on the column and returns the value. For example $rs = $schema->resultset("CD")->search({}); $length = $rs->get_column('title')->func('LENGTH');

Produces the following SQL SELECT LENGTH( title ) from cd me

AUTHORS

Luke Saunders <luke.saunders@gmail.com>

LICENSE

You may distribute this code under the same terms as Perl itself.