.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" 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" '' '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 turned on, 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. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "DBIx::Class::ResultSetColumn 3pm" .TH DBIx::Class::ResultSetColumn 3pm "2011-05-10" "perl v5.14.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 ]" 4 .el .IP "Return Value: \e[ \f(CW$sql\fR, \f(CW@bind\fR ]" 4 .IX Item "Return Value: [ $sql, @bind ]" .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 row 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 "AUTHORS" .IX Header "AUTHORS" Luke Saunders .PP Jess Robinson .SH "LICENSE" .IX Header "LICENSE" You may distribute this code under the same terms as Perl itself.