DBIx::Class::ResultSetColumn - helpful methods for messing
with a single column of the resultset
$rs = $schema->resultset('CD')->search({ artist => 'Tool' });
$rs_column = $rs->get_column('year');
$max_year = $rs_column->max; #returns latest year
A convenience class used to perform operations on a specific column of a resultset.
my $obj = DBIx::Class::ResultSetColumn->new($rs, $column);
Creates a new resultset column object from the resultset and column passed as params. Used internally by "get_column" in DBIx::Class::ResultSet.
Returns the SQL query and bind vars associated with the invocant.
This is generally used as the RHS for a subquery.
NOTE: This feature is still experimental.
Returns the next value of the column in the resultset (or undef if there is none).
Much like "next" in DBIx::Class::ResultSet but just returning the one value.
Returns all values of the column in the resultset (or undef if there are none).
Much like "all" in DBIx::Class::ResultSet but returns values rather than row objects.
Resets the underlying resultset's cursor, so you can iterate through the elements of the column again.
Much like "reset" in DBIx::Class::ResultSet.
Resets the underlying resultset and returns the next value of the column in the resultset (or undef if there is none).
Much like "first" in DBIx::Class::ResultSet but just returning the one value.
my $first_year = $year_col->min();
Wrapper for ->func. Returns the lowest value of the column in the resultset (or undef if there are none).
my $rs = $year_col->min_rs();
Wrapper for ->func_rs for function MIN().
my $last_year = $year_col->max();
Wrapper for ->func. Returns the highest value of the column in the resultset (or undef if there are none).
my $rs = $year_col->max_rs();
Wrapper for ->func_rs for function MAX().
my $total = $prices_col->sum();
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.
my $rs = $year_col->sum_rs();
Wrapper for ->func_rs for function SUM().
$rs = $schema->resultset("CD")->search({});
$length = $rs->get_column('title')->func('LENGTH');
Runs a query using the function on the column and returns the value. Produces the following SQL:
SELECT LENGTH( title ) FROM cd me
Creates the resultset that func() uses to run its query.
See "throw_exception" in DBIx::Class::Schema for details.
MODIFY_CODE_ATTRIBUTES, component_base_class, mk_classaccessor, mk_classdata
inject_base, load_optional_class
ensure_class_found, ensure_class_loaded, load_components, load_optional_components, load_own_components
get_component_class, get_inherited, get_simple, get_super_paths, make_group_accessor, make_group_ro_accessor, make_group_wo_accessor, mk_group_accessors, mk_group_ro_accessors, mk_group_wo_accessors, set_component_class, set_inherited, set_simple
Luke Saunders <luke.saunders@gmail.com>
Jess Robinson
You may distribute this code under the same terms as Perl itself.
Last modified:
POD_DERIVED_INDEX_GENERATED The following documentation is automatically generated. Please do not edit this file, but rather the original, inline with DBIx::Class::ResultSetColumn at blib/lib/DBIx/Class/ResultSetColumn.pm (on the system that originally ran this). If you do edit this file, and don't want your changes to be removed, make sure you change the first line.