DBIx-Custom / DBIx-Custom-0.1711 / blib / man3 / DBIx::Custom::Result.3pm /
bd35c82 12 years ago
1 contributor
409 lines | 10.922kb
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.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.  | will give a
.\" real vertical bar.  \*(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-|\(bv\*(Tr
.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\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" 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::Custom::Result 3"
.TH DBIx::Custom::Result 3 "2011-08-02" "perl v5.8.8" "User Contributed Perl Documentation"
.SH "NAME"
DBIx::Custom::Result \- Result of select statement
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\&    # Result
\&    my $result = $dbi->select(table => 'book');
.Ve
.PP
.Vb 5
\&    # Fetch a row and put it into array reference
\&    while (my $row = $result->fetch) {
\&        my $author = $row->[0];
\&        my $title  = $row->[1];
\&    }
.Ve
.PP
.Vb 2
\&    # Fetch only a first row and put it into array reference
\&    my $row = $result->fetch_first;
.Ve
.PP
.Vb 2
\&    # Fetch all rows and put them into array of array reference
\&    my $rows = $result->fetch_all;
.Ve
.PP
.Vb 5
\&    # Fetch a row and put it into hash reference
\&    while (my $row = $result->fetch_hash) {
\&        my $title  = $row->{title};
\&        my $author = $row->{author};
\&    }
.Ve
.PP
.Vb 3
\&    # Fetch only a first row and put it into hash reference
\&    my $row = $result->fetch_hash_first;
\&    my $row = $result->one; # Same as fetch_hash_first
.Ve
.PP
.Vb 3
\&    # Fetch all rows and put them into array of hash reference
\&    my $rows = $result->fetch_hash_all;
\&    my $rows = $result->all; # Same as fetch_hash_all
.Ve
.SH "ATTRIBUTES"
.IX Header "ATTRIBUTES"
.ie n .Sh """dbi"""
.el .Sh "\f(CWdbi\fP"
.IX Subsection "dbi"
.Vb 2
\&    my $dbi = $result->dbi;
\&    $result = $result->dbi($dbi);
.Ve
.PP
DBIx::Custom object.
.ie n .Sh """sth"""
.el .Sh "\f(CWsth\fP"
.IX Subsection "sth"
.Vb 2
\&    my $sth = $reuslt->sth
\&    $result = $result->sth($sth);
.Ve
.PP
Statement handle of \s-1DBI\s0.
.SH "METHODS"
.IX Header "METHODS"
DBIx::Custom::Result inherits all methods from Object::Simple
and implements the following new ones.
.ie n .Sh """all"""
.el .Sh "\f(CWall\fP"
.IX Subsection "all"
.Vb 1
\&    my $rows = $result->all;
.Ve
.PP
Same as \f(CW\*(C`fetch_hash_all\*(C'\fR.
.ie n .Sh """fetch"""
.el .Sh "\f(CWfetch\fP"
.IX Subsection "fetch"
.Vb 1
\&    my $row = $result->fetch;
.Ve
.PP
Fetch a row and put it into array reference.
.ie n .Sh """fetch_all"""
.el .Sh "\f(CWfetch_all\fP"
.IX Subsection "fetch_all"
.Vb 1
\&    my $rows = $result->fetch_all;
.Ve
.PP
Fetch all rows and put them into array of array reference.
.ie n .Sh """fetch_first"""
.el .Sh "\f(CWfetch_first\fP"
.IX Subsection "fetch_first"
.Vb 1
\&    my $row = $result->fetch_first;
.Ve
.PP
Fetch only a first row and put it into array reference,
and finish statment handle.
.ie n .Sh """fetch_hash"""
.el .Sh "\f(CWfetch_hash\fP"
.IX Subsection "fetch_hash"
.Vb 1
\&    my $row = $result->fetch_hash;
.Ve
.PP
Fetch a row and put it into hash reference.
.ie n .Sh """fetch_hash_all"""
.el .Sh "\f(CWfetch_hash_all\fP"
.IX Subsection "fetch_hash_all"
.Vb 1
\&    my $rows = $result->fetch_hash_all;
.Ve
.PP
Fetch all rows and put them into array of hash reference.
.ie n .Sh """fetch_hash_first"""
.el .Sh "\f(CWfetch_hash_first\fP"
.IX Subsection "fetch_hash_first"
.Vb 1
\&    my $row = $result->fetch_hash_first;
.Ve
.PP
Fetch only a first row and put it into hash reference,
and finish statment handle.
.ie n .Sh """fetch_hash_multi"""
.el .Sh "\f(CWfetch_hash_multi\fP"
.IX Subsection "fetch_hash_multi"
.Vb 1
\&    my $rows = $result->fetch_hash_multi(5);
.Ve
.PP
Fetch multiple rows and put them into array of hash reference.
.ie n .Sh """fetch_multi"""
.el .Sh "\f(CWfetch_multi\fP"
.IX Subsection "fetch_multi"
.Vb 1
\&    my $rows = $result->fetch_multi(5);
.Ve
.PP
Fetch multiple rows and put them into array of array reference.
.ie n .Sh """filter"""
.el .Sh "\f(CWfilter\fP"
.IX Subsection "filter"
.Vb 2
\&    $result->filter(title  => sub { uc $_[0] }, author => 'to_upper');
\&    $result->filter([qw/title author/] => 'to_upper');
.Ve
.PP
Set filter for column.
You can use subroutine or filter name as filter.
This filter is executed after \f(CW\*(C`type_rule\*(C'\fR filter.
.ie n .Sh """filter_off"" \s-1EXPERIMENTAL\s0"
.el .Sh "\f(CWfilter_off\fP \s-1EXPERIMENTAL\s0"
.IX Subsection "filter_off EXPERIMENTAL"
.Vb 1
\&    $result = $result->filter_off;
.Ve
.PP
Turn filtering by \f(CW\*(C`filter\*(C'\fR method off.
By default, filterin is on.
.ie n .Sh """filter_on"" \s-1EXPERIMENTAL\s0"
.el .Sh "\f(CWfilter_on\fP \s-1EXPERIMENTAL\s0"
.IX Subsection "filter_on EXPERIMENTAL"
.Vb 1
\&    $result = $resutl->filter_on;
.Ve
.PP
Turn filtering by \f(CW\*(C`filter\*(C'\fR method on.
By default, filterin is on.
.ie n .Sh """header"""
.el .Sh "\f(CWheader\fP"
.IX Subsection "header"
.Vb 1
\&    my $header = $result->header;
.Ve
.PP
Get header column names.
.ie n .Sh """one"""
.el .Sh "\f(CWone\fP"
.IX Subsection "one"
.Vb 1
\&    my $row = $result->one;
.Ve
.PP
Same as \f(CW\*(C`fetch_hash_first\*(C'\fR.
.ie n .Sh """stash"""
.el .Sh "\f(CWstash\fP"
.IX Subsection "stash"
.Vb 3
\&    my $stash = $result->stash;
\&    my $foo = $result->stash->{foo};
\&    $result->stash->{foo} = $foo;
.Ve
.PP
Stash is hash reference for data.
.ie n .Sh """type_rule"" \s-1EXPERIMENTAL\s0"
.el .Sh "\f(CWtype_rule\fP \s-1EXPERIMENTAL\s0"
.IX Subsection "type_rule EXPERIMENTAL"
.Vb 7
\&    # Merge type rule
\&    $result->type_rule(
\&        # DATE
\&        9 => sub { ... },
\&        # DATETIME or TIMESTAMP
\&        11 => sub { ... }
\&    );
.Ve
.PP
.Vb 7
\&    # Replace type rule(by reference)
\&    $result->type_rule([
\&        # DATE
\&        9 => sub { ... },
\&        # DATETIME or TIMESTAMP
\&        11 => sub { ... }
\&    ]);
.Ve
.PP
This is same as DBIx::Custom's \f(CW\*(C`type_rule\*(C'\fR's <from>.
.ie n .Sh """type_rule_off"" \s-1EXPERIMENTAL\s0"
.el .Sh "\f(CWtype_rule_off\fP \s-1EXPERIMENTAL\s0"
.IX Subsection "type_rule_off EXPERIMENTAL"
.Vb 1
\&    $result = $result->type_rule_off;
.Ve
.PP
Turn \f(CW\*(C`from1\*(C'\fR and \f(CW\*(C`from2\*(C'\fR type rule off.
By default, type rule is on.
.ie n .Sh """type_rule_on"" \s-1EXPERIMENTAL\s0"
.el .Sh "\f(CWtype_rule_on\fP \s-1EXPERIMENTAL\s0"
.IX Subsection "type_rule_on EXPERIMENTAL"
.Vb 1
\&    $result = $result->type_rule_on;
.Ve
.PP
Turn \f(CW\*(C`from1\*(C'\fR and \f(CW\*(C`from2\*(C'\fR type rule on.
By default, type rule is on.
.ie n .Sh """type_rule1_off"" \s-1EXPERIMENTAL\s0"
.el .Sh "\f(CWtype_rule1_off\fP \s-1EXPERIMENTAL\s0"
.IX Subsection "type_rule1_off EXPERIMENTAL"
.Vb 1
\&    $result = $result->type_rule1_off;
.Ve
.PP
Turn \f(CW\*(C`from1\*(C'\fR type rule off.
By default, type rule is on.
.ie n .Sh """type_rule1_on"" \s-1EXPERIMENTAL\s0"
.el .Sh "\f(CWtype_rule1_on\fP \s-1EXPERIMENTAL\s0"
.IX Subsection "type_rule1_on EXPERIMENTAL"
.Vb 1
\&    $result = $result->type_rule1_on;
.Ve
.PP
Turn \f(CW\*(C`from1\*(C'\fR type rule on.
By default, type rule is on.
.ie n .Sh """type_rule2_off"" \s-1EXPERIMENTAL\s0"
.el .Sh "\f(CWtype_rule2_off\fP \s-1EXPERIMENTAL\s0"
.IX Subsection "type_rule2_off EXPERIMENTAL"
.Vb 1
\&    $result = $result->type_rule2_off;
.Ve
.PP
Turn \f(CW\*(C`from2\*(C'\fR type rule off.
By default, type rule is on.
.ie n .Sh """type_rule2_on"" \s-1EXPERIMENTAL\s0"
.el .Sh "\f(CWtype_rule2_on\fP \s-1EXPERIMENTAL\s0"
.IX Subsection "type_rule2_on EXPERIMENTAL"
.Vb 1
\&    $result = $result->type_rule2_on;
.Ve
.PP
Turn \f(CW\*(C`from2\*(C'\fR type rule on.
By default, type rule is on.