.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "DBIx::Class::ResultSetColumn 3pm" .TH DBIx::Class::ResultSetColumn 3pm "2018-04-19" "perl v5.26.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" .Vb 2 \& DBIx::Class::ResultSetColumn \- helpful methods for messing \& with a single column of the resultset .Ve .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& $rs = $schema\->resultset(\*(AqCD\*(Aq)\->search({ artist => \*(AqTool\*(Aq }); \& $rs_column = $rs\->get_column(\*(Aqyear\*(Aq); \& $max_year = $rs_column\->max; #returns latest year .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" A convenience class used to perform operations on a specific column of a resultset. .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" .Vb 1 \& my $obj = DBIx::Class::ResultSetColumn\->new($rs, $column); .Ve .PP Creates a new resultset column object from the resultset and column passed as params. Used internally by \*(L"get_column\*(R" in DBIx::Class::ResultSet. .SS "as_query" .IX Subsection "as_query" .IP "Arguments: none" 4 .IX Item "Arguments: none" .PD 0 .ie n .IP "Return Value: \e[ $sql, @bind_values ]" 4 .el .IP "Return Value: \e[ \f(CW$sql\fR, \f(CW@bind_values\fR ]" 4 .IX Item "Return Value: [ $sql, @bind_values ]" .PD .PP Returns the \s-1SQL\s0 query and bind vars associated with the invocant. .PP This is generally used as the \s-1RHS\s0 for a subquery. .SS "next" .IX Subsection "next" .IP "Arguments: none" 4 .IX Item "Arguments: none" .PD 0 .ie n .IP "Return Value: $value" 4 .el .IP "Return Value: \f(CW$value\fR" 4 .IX Item "Return Value: $value" .PD .PP Returns the next value of the column in the resultset (or \f(CW\*(C`undef\*(C'\fR if there is none). .PP Much like \*(L"next\*(R" in DBIx::Class::ResultSet but just returning the one value. .SS "all" .IX Subsection "all" .IP "Arguments: none" 4 .IX Item "Arguments: none" .PD 0 .ie n .IP "Return Value: @values" 4 .el .IP "Return Value: \f(CW@values\fR" 4 .IX Item "Return Value: @values" .PD .PP Returns all values of the column in the resultset (or \f(CW\*(C`undef\*(C'\fR if there are none). .PP Much like \*(L"all\*(R" in DBIx::Class::ResultSet but returns values rather than result objects. .SS "reset" .IX Subsection "reset" .IP "Arguments: none" 4 .IX Item "Arguments: none" .PD 0 .ie n .IP "Return Value: $self" 4 .el .IP "Return Value: \f(CW$self\fR" 4 .IX Item "Return Value: $self" .PD .PP Resets the underlying resultset's cursor, so you can iterate through the elements of the column again. .PP Much like \*(L"reset\*(R" in DBIx::Class::ResultSet. .SS "first" .IX Subsection "first" .IP "Arguments: none" 4 .IX Item "Arguments: none" .PD 0 .ie n .IP "Return Value: $value" 4 .el .IP "Return Value: \f(CW$value\fR" 4 .IX Item "Return Value: $value" .PD .PP Resets the underlying resultset and returns the next value of the column in the resultset (or \f(CW\*(C`undef\*(C'\fR if there is none). .PP Much like \*(L"first\*(R" in DBIx::Class::ResultSet but just returning the one value. .SS "single" .IX Subsection "single" .IP "Arguments: none" 4 .IX Item "Arguments: none" .PD 0 .ie n .IP "Return Value: $value" 4 .el .IP "Return Value: \f(CW$value\fR" 4 .IX Item "Return Value: $value" .PD .PP Much like \*(L"single\*(R" in DBIx::Class::ResultSet fetches one and only one column value using the cursor directly. If additional rows are present a warning is issued before discarding the cursor. .SS "min" .IX Subsection "min" .IP "Arguments: none" 4 .IX Item "Arguments: none" .PD 0 .ie n .IP "Return Value: $lowest_value" 4 .el .IP "Return Value: \f(CW$lowest_value\fR" 4 .IX Item "Return Value: $lowest_value" .PD .PP .Vb 1 \& my $first_year = $year_col\->min(); .Ve .PP Wrapper for \->func. Returns the lowest value of the column in the resultset (or \f(CW\*(C`undef\*(C'\fR if there are none). .SS "min_rs" .IX Subsection "min_rs" .IP "Arguments: none" 4 .IX Item "Arguments: none" .PD 0 .ie n .IP "Return Value: $resultset" 4 .el .IP "Return Value: \f(CW$resultset\fR" 4 .IX Item "Return Value: $resultset" .PD .PP .Vb 1 \& my $rs = $year_col\->min_rs(); .Ve .PP Wrapper for \->func_rs for function \s-1\fIMIN\s0()\fR. .SS "max" .IX Subsection "max" .IP "Arguments: none" 4 .IX Item "Arguments: none" .PD 0 .ie n .IP "Return Value: $highest_value" 4 .el .IP "Return Value: \f(CW$highest_value\fR" 4 .IX Item "Return Value: $highest_value" .PD .PP .Vb 1 \& my $last_year = $year_col\->max(); .Ve .PP Wrapper for \->func. Returns the highest value of the column in the resultset (or \f(CW\*(C`undef\*(C'\fR if there are none). .SS "max_rs" .IX Subsection "max_rs" .IP "Arguments: none" 4 .IX Item "Arguments: none" .PD 0 .ie n .IP "Return Value: $resultset" 4 .el .IP "Return Value: \f(CW$resultset\fR" 4 .IX Item "Return Value: $resultset" .PD .PP .Vb 1 \& my $rs = $year_col\->max_rs(); .Ve .PP Wrapper for \->func_rs for function \s-1\fIMAX\s0()\fR. .SS "sum" .IX Subsection "sum" .IP "Arguments: none" 4 .IX Item "Arguments: none" .PD 0 .ie n .IP "Return Value: $sum_of_values" 4 .el .IP "Return Value: \f(CW$sum_of_values\fR" 4 .IX Item "Return Value: $sum_of_values" .PD .PP .Vb 1 \& my $total = $prices_col\->sum(); .Ve .PP 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. .SS "sum_rs" .IX Subsection "sum_rs" .IP "Arguments: none" 4 .IX Item "Arguments: none" .PD 0 .ie n .IP "Return Value: $resultset" 4 .el .IP "Return Value: \f(CW$resultset\fR" 4 .IX Item "Return Value: $resultset" .PD .PP .Vb 1 \& my $rs = $year_col\->sum_rs(); .Ve .PP Wrapper for \->func_rs for function \s-1\fISUM\s0()\fR. .SS "func" .IX Subsection "func" .ie n .IP "Arguments: $function" 4 .el .IP "Arguments: \f(CW$function\fR" 4 .IX Item "Arguments: $function" .PD 0 .ie n .IP "Return Value: $function_return_value" 4 .el .IP "Return Value: \f(CW$function_return_value\fR" 4 .IX Item "Return Value: $function_return_value" .PD .PP .Vb 2 \& $rs = $schema\->resultset("CD")\->search({}); \& $length = $rs\->get_column(\*(Aqtitle\*(Aq)\->func(\*(AqLENGTH\*(Aq); .Ve .PP Runs a query using the function on the column and returns the value. Produces the following \s-1SQL:\s0 .PP .Vb 1 \& SELECT LENGTH( title ) FROM cd me .Ve .SS "func_rs" .IX Subsection "func_rs" .ie n .IP "Arguments: $function" 4 .el .IP "Arguments: \f(CW$function\fR" 4 .IX Item "Arguments: $function" .PD 0 .ie n .IP "Return Value: $resultset" 4 .el .IP "Return Value: \f(CW$resultset\fR" 4 .IX Item "Return Value: $resultset" .PD .PP Creates the resultset that \f(CW\*(C`func()\*(C'\fR uses to run its query. .SS "throw_exception" .IX Subsection "throw_exception" See \*(L"throw_exception\*(R" in DBIx::Class::Schema for details. .SH "FURTHER QUESTIONS?" .IX Header "FURTHER QUESTIONS?" Check the list of additional \s-1DBIC\s0 resources. .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This module is free software copyright by the DBIx::Class (\s-1DBIC\s0) authors. You can redistribute it and/or modify it under the same terms as the DBIx::Class library.