Newer Older
517 lines | 10.964kb
packaging one directory
yuki-kimoto authored on 2009-11-16
1
package DBIx::Custom::Result;
update document
yuki-kimoto authored on 2009-11-17
2

            
packaging one directory
yuki-kimoto authored on 2009-11-16
3
use strict;
4
use warnings;
update document
yuki-kimoto authored on 2010-01-30
5

            
6
use base 'Object::Simple';
cleanup
yuki-kimoto authored on 2010-02-11
7

            
packaging one directory
yuki-kimoto authored on 2009-11-16
8
use Carp 'croak';
cleanup
Yuki Kimoto authored on 2011-04-25
9
use DBIx::Custom::Util qw/_array_to_hash _subname/;
packaging one directory
yuki-kimoto authored on 2009-11-16
10

            
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-25
11
__PACKAGE__->attr(
type_rule can receive filter...
Yuki Kimoto authored on 2011-06-12
12
    [qw/filters filter_off sth type_rule type_rule_off/],
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-25
13
    stash => sub { {} }
14
);
cleanup
Yuki Kimoto authored on 2010-12-21
15

            
- added DBIx::Custom::Result...
Yuki Kimoto authored on 2011-06-07
16
*all = \&fetch_hash_all;
17

            
cleanup
Yuki Kimoto authored on 2010-12-21
18
sub filter {
19
    my $self = shift;
cleanup
Yuki Kimoto authored on 2010-12-22
20
    
21
    if (@_) {
all filter can receive array...
Yuki Kimoto authored on 2011-02-25
22
        my $filter = {};
cleanup
Yuki Kimoto authored on 2010-12-22
23
        
all filter can receive array...
Yuki Kimoto authored on 2011-02-25
24
        if (ref $_[0] eq 'HASH') {
25
            $filter = $_[0];
26
        }
27
        else {
cleanup
Yuki Kimoto authored on 2011-04-25
28
            $filter = _array_to_hash(
all filter can receive array...
Yuki Kimoto authored on 2011-02-25
29
                @_ > 1 ? [@_] : $_[0]
30
            );
31
        }
32
                
cleanup
Yuki Kimoto authored on 2010-12-22
33
        foreach my $column (keys %$filter) {
34
            my $fname = $filter->{$column};
fix bug : filter can't over...
Yuki Kimoto authored on 2011-02-09
35

            
36
            if  (exists $filter->{$column}
37
              && defined $fname
38
              && ref $fname ne 'CODE') 
39
            {
cleanup
Yuki Kimoto authored on 2011-04-25
40
              croak qq{Filter "$fname" is not registered" } . _subname
cleanup
Yuki Kimoto authored on 2010-12-22
41
                unless exists $self->filters->{$fname};
42
              
43
              $filter->{$column} = $self->filters->{$fname};
44
            }
cleanup
Yuki Kimoto authored on 2010-12-21
45
        }
cleanup
Yuki Kimoto authored on 2010-12-22
46
        
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
47
        $self->{filter} = {%{$self->filter}, %$filter};
cleanup
Yuki Kimoto authored on 2010-12-22
48
        
49
        return $self;
cleanup
Yuki Kimoto authored on 2010-12-21
50
    }
51
    
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
52
    return $self->{filter} ||= {};
53
}
54

            
55
sub end_filter {
56
    my $self = shift;
57
    
58
    if (@_) {
all filter can receive array...
Yuki Kimoto authored on 2011-02-25
59
        my $end_filter = {};
60
        
61
        if (ref $_[0] eq 'HASH') {
62
            $end_filter = $_[0];
63
        }
64
        else {
cleanup
Yuki Kimoto authored on 2011-04-25
65
            $end_filter = _array_to_hash(
all filter can receive array...
Yuki Kimoto authored on 2011-02-25
66
                @_ > 1 ? [@_] : $_[0]
67
            );
68
        }
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
69
        
70
        foreach my $column (keys %$end_filter) {
71
            my $fname = $end_filter->{$column};
fix bug : filter can't over...
Yuki Kimoto authored on 2011-02-09
72
            
73
            if  (exists $end_filter->{$column}
74
              && defined $fname
75
              && ref $fname ne 'CODE') 
76
            {
cleanup
Yuki Kimoto authored on 2011-04-25
77
              croak qq{Filter "$fname" is not registered" } . _subname
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
78
                unless exists $self->filters->{$fname};
79
              
80
              $end_filter->{$column} = $self->filters->{$fname};
81
            }
82
        }
83
        
84
        $self->{end_filter} = {%{$self->end_filter}, %$end_filter};
85
        
86
        return $self;
87
    }
88
    
89
    return $self->{end_filter} ||= {};
cleanup
Yuki Kimoto authored on 2010-12-21
90
}
cleanup
yuki-kimoto authored on 2010-01-21
91

            
packaging one directory
yuki-kimoto authored on 2009-11-16
92
sub fetch {
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
93
    my $self = shift;
94
    
cleanup
Yuki Kimoto authored on 2011-01-12
95
    # Filter
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
96
    my $filter = $self->filter;
97
    
98
    # End filter
99
    my $end_filter = $self->end_filter;
packaging one directory
yuki-kimoto authored on 2009-11-16
100
    
101
    # Fetch
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
102
    my @row = $self->{sth}->fetchrow_array;
packaging one directory
yuki-kimoto authored on 2009-11-16
103
    
cleanup
yuki-kimoto authored on 2010-08-05
104
    # No row
update document
yuki-kimoto authored on 2010-05-27
105
    return unless @row;
added check_filter attribute
yuki-kimoto authored on 2010-08-08
106
    
cleanup
yuki-kimoto authored on 2010-08-05
107
    # Filtering
added experimental iterate_a...
Yuki Kimoto authored on 2010-12-22
108
    my $columns = $self->{sth}->{NAME};
added type_rule method and f...
Yuki Kimoto authored on 2011-06-09
109
    my $types = $self->{sth}->{TYPE};
110
    my $type_rule = $self->type_rule || {};
111
    
cleanup
yuki-kimoto authored on 2010-08-05
112
    for (my $i = 0; $i < @$columns; $i++) {
update document
yuki-kimoto authored on 2010-05-27
113
        
changed type_rule arguments ...
Yuki Kimoto authored on 2011-06-12
114
        if (!$self->type_rule_off && $type_rule->{from} &&
115
            (my $rule = $type_rule->{from}->{$types->[$i]}))
added type_rule method and f...
Yuki Kimoto authored on 2011-06-09
116
        {
117
            $row[$i] = $rule->($row[$i]);
118
        }
119
        
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
120
        # Filter name
cleanup
yuki-kimoto authored on 2010-08-05
121
        my $column = $columns->[$i];
cleanup
Yuki Kimoto authored on 2010-12-21
122
        my $f  = exists $filter->{$column}
123
               ? $filter->{$column}
cleanup
Yuki Kimoto authored on 2010-12-22
124
               : $self->default_filter;
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
125
        my $ef = $end_filter->{$column};
some changed
yuki-kimoto authored on 2010-05-02
126
        
cleanup
yuki-kimoto authored on 2010-08-05
127
        # Filtering
type_rule can receive filter...
Yuki Kimoto authored on 2011-06-12
128
        $row[$i] = $f->($row[$i]) if $f && !$self->filter_off;
129
        $row[$i] = $ef->($row[$i]) if $ef && !$self->filter_off;
packaging one directory
yuki-kimoto authored on 2009-11-16
130
    }
many many changes
yuki-kimoto authored on 2010-04-30
131

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
132
    return \@row;
133
}
134

            
cleanup
yuki-kimoto authored on 2010-10-17
135
sub fetch_all {
136
    my $self = shift;
137
    
138
    # Fetch all rows
139
    my $rows = [];
140
    while(my $row = $self->fetch) {
141
        push @$rows, $row;
142
    }
143
    return $rows;
144
}
145

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
146
sub fetch_first {
147
    my $self = shift;
148
    
149
    # Fetch
150
    my $row = $self->fetch;
151
    
cleanup
yuki-kimoto authored on 2010-08-05
152
    # No row
removed reconnect method
yuki-kimoto authored on 2010-05-28
153
    return unless $row;
154
    
155
    # Finish statement handle
156
    $self->sth->finish;
157
    
158
    return $row;
159
}
160

            
packaging one directory
yuki-kimoto authored on 2009-11-16
161
sub fetch_hash {
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
162
    my $self = shift;
163
    
cleanup
Yuki Kimoto authored on 2011-01-12
164
    # Filter
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
165
    my $filter  = $self->filter;
166
    
167
    # End filter
168
    my $end_filter = $self->end_filter;
packaging one directory
yuki-kimoto authored on 2009-11-16
169
    
170
    # Fetch
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
171
    my $row = $self->{sth}->fetchrow_arrayref;
packaging one directory
yuki-kimoto authored on 2009-11-16
172
    
173
    # Cannot fetch
174
    return unless $row;
added check_filter attribute
yuki-kimoto authored on 2010-08-08
175

            
packaging one directory
yuki-kimoto authored on 2009-11-16
176
    # Filter
177
    my $row_hash = {};
added experimental iterate_a...
Yuki Kimoto authored on 2010-12-22
178
    my $columns = $self->{sth}->{NAME};
added type_rule method and f...
Yuki Kimoto authored on 2011-06-09
179
    my $types = $self->{sth}->{TYPE};
180
    my $type_rule = $self->type_rule || {};
cleanup
yuki-kimoto authored on 2010-08-05
181
    for (my $i = 0; $i < @$columns; $i++) {
update document
yuki-kimoto authored on 2010-05-27
182
        
added type_rule method and f...
Yuki Kimoto authored on 2011-06-09
183
        # Type rule
changed type_rule arguments ...
Yuki Kimoto authored on 2011-06-12
184
        if (!$self->type_rule_off && $type_rule->{from} &&
185
            (my $rule = $type_rule->{from}->{$types->[$i]}))
added type_rule method and f...
Yuki Kimoto authored on 2011-06-09
186
        {
187
            $row->[$i] = $rule->($row->[$i]);
188
        }
189
        
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
190
        # Filter name
cleanup
yuki-kimoto authored on 2010-08-05
191
        my $column = $columns->[$i];
cleanup
Yuki Kimoto authored on 2010-12-21
192
        my $f  = exists $filter->{$column}
193
               ? $filter->{$column}
cleanup
Yuki Kimoto authored on 2010-12-22
194
               : $self->default_filter;
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
195
        my $ef = $end_filter->{$column};
add query filter error check
yuki-kimoto authored on 2010-05-14
196
        
cleanup
yuki-kimoto authored on 2010-08-05
197
        # Filtering
type_rule can receive filter...
Yuki Kimoto authored on 2011-06-12
198
        $row_hash->{$column} = $f && !$self->filter_off ? $f->($row->[$i])
199
                                                        : $row->[$i];
200
        $row_hash->{$column} = $ef->($row_hash->{$column})
201
          if $ef && !$self->filter_off;
packaging one directory
yuki-kimoto authored on 2009-11-16
202
    }
203
    
removed reconnect method
yuki-kimoto authored on 2010-05-28
204
    return $row_hash;
packaging one directory
yuki-kimoto authored on 2009-11-16
205
}
206

            
cleanup
yuki-kimoto authored on 2010-10-17
207
sub fetch_hash_all {
208
    my $self = shift;
209
    
210
    # Fetch all rows as hash
211
    my $rows = [];
212
    while(my $row = $self->fetch_hash) {
213
        push @$rows, $row;
214
    }
215
    
216
    return $rows;
217
}
218

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
219
sub fetch_hash_first {
packaging one directory
yuki-kimoto authored on 2009-11-16
220
    my $self = shift;
221
    
222
    # Fetch hash
223
    my $row = $self->fetch_hash;
224
    
cleanup
yuki-kimoto authored on 2010-08-05
225
    # No row
packaging one directory
yuki-kimoto authored on 2009-11-16
226
    return unless $row;
227
    
228
    # Finish statement handle
some changed
yuki-kimoto authored on 2010-05-02
229
    $self->sth->finish;
packaging one directory
yuki-kimoto authored on 2009-11-16
230
    
removed reconnect method
yuki-kimoto authored on 2010-05-28
231
    return $row;
packaging one directory
yuki-kimoto authored on 2009-11-16
232
}
233

            
renamed fetch_rows to fetch_...
yuki-kimoto authored on 2010-05-01
234
sub fetch_hash_multi {
packaging one directory
yuki-kimoto authored on 2009-11-16
235
    my ($self, $count) = @_;
236
    
cleanup
yuki-kimoto authored on 2010-08-05
237
    # Row count not specified
cleanup
Yuki Kimoto authored on 2011-04-25
238
    croak 'Row count must be specified ' . _subname
packaging one directory
yuki-kimoto authored on 2009-11-16
239
      unless $count;
240
    
241
    # Fetch multi rows
242
    my $rows = [];
243
    for (my $i = 0; $i < $count; $i++) {
removed reconnect method
yuki-kimoto authored on 2010-05-28
244
        my $row = $self->fetch_hash;
245
        last unless $row;
246
        push @$rows, $row;
packaging one directory
yuki-kimoto authored on 2009-11-16
247
    }
248
    
249
    return unless @$rows;
removed reconnect method
yuki-kimoto authored on 2010-05-28
250
    return $rows;
packaging one directory
yuki-kimoto authored on 2009-11-16
251
}
252

            
cleanup
yuki-kimoto authored on 2010-10-17
253
sub fetch_multi {
254
    my ($self, $count) = @_;
packaging one directory
yuki-kimoto authored on 2009-11-16
255
    
cleanup
yuki-kimoto authored on 2010-10-17
256
    # Row count not specifed
cleanup
Yuki Kimoto authored on 2011-04-25
257
    croak 'Row count must be specified ' . _subname
cleanup
yuki-kimoto authored on 2010-10-17
258
      unless $count;
259
    
260
    # Fetch multi rows
packaging one directory
yuki-kimoto authored on 2009-11-16
261
    my $rows = [];
cleanup
yuki-kimoto authored on 2010-10-17
262
    for (my $i = 0; $i < $count; $i++) {
263
        my $row = $self->fetch;
264
        last unless $row;
removed reconnect method
yuki-kimoto authored on 2010-05-28
265
        push @$rows, $row;
packaging one directory
yuki-kimoto authored on 2009-11-16
266
    }
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
267
    
cleanup
yuki-kimoto authored on 2010-10-17
268
    return unless @$rows;
removed reconnect method
yuki-kimoto authored on 2010-05-28
269
    return $rows;
packaging one directory
yuki-kimoto authored on 2009-11-16
270
}
271

            
- added DBIx::Custom::Result...
Yuki Kimoto authored on 2011-06-07
272
*one = \&fetch_hash_first;
273

            
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
274
sub remove_end_filter {
275
    my $self = shift;
276
    
277
    $self->{end_filter} = {};
278
    
279
    return $self;
280
}
281

            
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
282
sub remove_filter {
283
    my $self = shift;
284
    
285
    $self->{filter} = {};
286
    
287
    return $self;
288
}
289

            
cleanup
Yuki Kimoto authored on 2011-01-12
290
# Deprecated
291
sub default_filter {
292
    my $self = shift;
293
    
294
    if (@_) {
295
        my $fname = $_[0];
296
        if (@_ && !$fname) {
297
            $self->{default_filter} = undef;
298
        }
299
        else {
many changed
Yuki Kimoto authored on 2011-01-23
300
            croak qq{Filter "$fname" is not registered}
cleanup
Yuki Kimoto authored on 2011-01-12
301
              unless exists $self->filters->{$fname};
302
        
303
            $self->{default_filter} = $self->filters->{$fname};
304
        }
305
        
306
        return $self;
307
    }
308
    
309
    return $self->{default_filter};
310
}
311

            
cleanup
Yuki Kimoto authored on 2011-01-23
312
# DEPRECATED!
313
__PACKAGE__->attr('filter_check'); 
314

            
update document
yuki-kimoto authored on 2010-01-30
315
1;
316

            
packaging one directory
yuki-kimoto authored on 2009-11-16
317
=head1 NAME
318

            
cleanup
yuki-kimoto authored on 2010-08-05
319
DBIx::Custom::Result - Result of select statement
packaging one directory
yuki-kimoto authored on 2009-11-16
320

            
update document
yuki-kimoto authored on 2010-01-30
321
=head1 SYNOPSIS
cleanup
yuki-kimoto authored on 2010-08-05
322

            
323
Get the result of select statement.
324

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
325
    # Result
326
    my $result = $dbi->select(table => 'books');
cleanup
yuki-kimoto authored on 2010-08-05
327

            
328
Fetch row into array.
removed reconnect method
yuki-kimoto authored on 2010-05-28
329
    
330
    # Fetch a row into array
331
    while (my $row = $result->fetch) {
cleanup
yuki-kimoto authored on 2010-08-05
332
        my $author = $row->[0];
333
        my $title  = $row->[1];
removed reconnect method
yuki-kimoto authored on 2010-05-28
334
        
version 0.0901
yuki-kimoto authored on 2009-12-17
335
    }
336
    
cleanup
yuki-kimoto authored on 2010-08-05
337
    # Fetch only a first row into array
removed reconnect method
yuki-kimoto authored on 2010-05-28
338
    my $row = $result->fetch_first;
339
    
340
    # Fetch multiple rows into array of array
341
    while (my $rows = $result->fetch_multi(5)) {
cleanup
yuki-kimoto authored on 2010-08-05
342
        my $first_author  = $rows->[0][0];
343
        my $first_title   = $rows->[0][1];
344
        my $second_author = $rows->[1][0];
345
        my $second_value  = $rows->[1][1];
346
    
removed reconnect method
yuki-kimoto authored on 2010-05-28
347
    }
348
    
349
    # Fetch all rows into array of array
350
    my $rows = $result->fetch_all;
cleanup
yuki-kimoto authored on 2010-08-05
351

            
352
Fetch row into hash.
353

            
354
    # Fetch a row into hash
removed reconnect method
yuki-kimoto authored on 2010-05-28
355
    while (my $row = $result->fetch_hash) {
cleanup
yuki-kimoto authored on 2010-08-05
356
        my $title  = $row->{title};
357
        my $author = $row->{author};
removed reconnect method
yuki-kimoto authored on 2010-05-28
358
        
packaging one directory
yuki-kimoto authored on 2009-11-16
359
    }
removed reconnect method
yuki-kimoto authored on 2010-05-28
360
    
cleanup
yuki-kimoto authored on 2010-08-05
361
    # Fetch only a first row into hash
removed reconnect method
yuki-kimoto authored on 2010-05-28
362
    my $row = $result->fetch_hash_first;
363
    
364
    # Fetch multiple rows into array of hash
cleanup
yuki-kimoto authored on 2010-08-05
365
    while (my $rows = $result->fetch_hash_multi(5)) {
366
        my $first_title   = $rows->[0]{title};
367
        my $first_author  = $rows->[0]{author};
368
        my $second_title  = $rows->[1]{title};
369
        my $second_author = $rows->[1]{author};
removed reconnect method
yuki-kimoto authored on 2010-05-28
370
    }
371
    
372
    # Fetch all rows into array of hash
373
    my $rows = $result->fetch_hash_all;
packaging one directory
yuki-kimoto authored on 2009-11-16
374

            
update document
yuki-kimoto authored on 2010-01-30
375
=head1 ATTRIBUTES
packaging one directory
yuki-kimoto authored on 2009-11-16
376

            
cleanup
yuki-kimoto authored on 2010-08-05
377
Filters when a row is fetched.
378
This overwrites C<default_filter>.
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
379

            
updated_pod
Yuki Kimoto authored on 2011-06-12
380
=head2 C<filter_off> EXPERIMENTAL
381

            
382
    my $filter_off = $resutl->filter_off;
383
    $result = $result->filter_off(1);
384

            
385
Turn filter off.
386

            
cleanup
yuki-kimoto authored on 2010-10-17
387
=head2 C<filters>
388

            
389
    my $filters = $result->filters;
390
    $result     = $result->filters(\%filters);
391

            
392
Resistered filters.
393

            
394
=head2 C<sth>
395

            
396
    my $sth = $reuslt->sth
397
    $result = $result->sth($sth);
398

            
399
Statement handle of L<DBI>.
400

            
added EXPERIMENTAL execute()...
Yuki Kimoto authored on 2011-06-09
401
=head2 C<type_rule_off> EXPERIMENTAL
402

            
403
    my $type_rule_off = $result->type_rule_off;
404
    $result = $result->type_rule_off(1);
405

            
406
Turn type rule off.
407

            
update document
yuki-kimoto authored on 2010-01-30
408
=head1 METHODS
409

            
renamed build_query to creat...
yuki-kimoto authored on 2010-08-06
410
L<DBIx::Custom::Result> inherits all methods from L<Object::Simple>
cleanup
yuki-kimoto authored on 2010-08-05
411
and implements the following new ones.
packaging one directory
yuki-kimoto authored on 2009-11-16
412

            
updated pod
Yuki Kimoto authored on 2011-06-07
413
=head2 C<all>
414

            
415
    my $rows = $result->all;
416

            
417
This is alias for C<fetch_hash_all>.
418

            
- removed DEPRECATED DBIx::C...
Yuki Kimoto authored on 2011-04-11
419
=head2 C<end_filter>
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
420

            
all filter can receive array...
Yuki Kimoto authored on 2011-02-25
421
    $result = $result->end_filter(title  => 'to_something',
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-25
422
                                     author => 'to_something');
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
423

            
all filter can receive array...
Yuki Kimoto authored on 2011-02-25
424
    $result = $result->end_filter([qw/title author/] => 'to_something');
425

            
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
426
End filters.
427
These each filters is executed after the filters applied by C<apply_filter> of
428
L<DBIx::Custom> or C<filter> method.
429

            
removed DBIx::Custom commit ...
yuki-kimoto authored on 2010-07-14
430
=head2 C<fetch>
packaging one directory
yuki-kimoto authored on 2009-11-16
431

            
cleanup
yuki-kimoto authored on 2010-08-05
432
    my $row = $result->fetch;
version 0.0901
yuki-kimoto authored on 2009-12-17
433

            
cleanup
yuki-kimoto authored on 2010-08-05
434
Fetch a row into array.
packaging one directory
yuki-kimoto authored on 2009-11-16
435

            
removed DBIx::Custom commit ...
yuki-kimoto authored on 2010-07-14
436
=head2 C<fetch_all>
packaging one directory
yuki-kimoto authored on 2009-11-16
437

            
cleanup
yuki-kimoto authored on 2010-08-05
438
    my $rows = $result->fetch_all;
version 0.0901
yuki-kimoto authored on 2009-12-17
439

            
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
440
Fetch all rows into array of array.
packaging one directory
yuki-kimoto authored on 2009-11-16
441

            
cleanup
yuki-kimoto authored on 2010-10-17
442
=head2 C<fetch_first>
443

            
444
    my $row = $result->fetch_first;
445

            
446
Fetch only a first row into array and finish statment handle.
447

            
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
448
=head2 C<fetch_hash>
packaging one directory
yuki-kimoto authored on 2009-11-16
449

            
cleanup
yuki-kimoto authored on 2010-08-05
450
    my $row = $result->fetch_hash;
packaging one directory
yuki-kimoto authored on 2009-11-16
451

            
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
452
Fetch a row into hash
update document
yuki-kimoto authored on 2009-11-19
453

            
cleanup
yuki-kimoto authored on 2010-10-17
454
=head2 C<fetch_hash_all>
455

            
456
    my $rows = $result->fetch_hash_all;
457

            
458
Fetch all rows into array of hash.
459

            
removed DBIx::Custom commit ...
yuki-kimoto authored on 2010-07-14
460
=head2 C<fetch_hash_first>
removed reconnect method
yuki-kimoto authored on 2010-05-28
461
    
cleanup
yuki-kimoto authored on 2010-08-05
462
    my $row = $result->fetch_hash_first;
packaging one directory
yuki-kimoto authored on 2009-11-16
463

            
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
464
Fetch only first row into hash and finish statment handle.
packaging one directory
yuki-kimoto authored on 2009-11-16
465

            
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
466
=head2 C<fetch_hash_multi>
update document
yuki-kimoto authored on 2009-11-19
467

            
cleanup
yuki-kimoto authored on 2010-08-05
468
    my $rows = $result->fetch_hash_multi(5);
update document
yuki-kimoto authored on 2009-11-19
469
    
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
470
Fetch multiple rows into array of hash
cleanup
yuki-kimoto authored on 2010-08-05
471
Row count must be specified.
update document
yuki-kimoto authored on 2009-11-19
472

            
cleanup
yuki-kimoto authored on 2010-10-17
473
=head2 C<fetch_multi>
packaging one directory
yuki-kimoto authored on 2009-11-16
474

            
cleanup
yuki-kimoto authored on 2010-10-17
475
    my $rows = $result->fetch_multi(5);
476
    
477
Fetch multiple rows into array of array.
478
Row count must be specified.
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
479

            
cleanup
Yuki Kimoto authored on 2010-12-21
480
=head2 C<filter>
481

            
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-25
482
    $result = $result->filter(title  => 'to_something',
483
                              author => 'to_something');
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
484

            
all filter can receive array...
Yuki Kimoto authored on 2011-02-25
485
    $result = $result->filter([qw/title author/] => 'to_something');
486

            
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
487
Filters.
488
These each filters override the filters applied by C<apply_filter> of
489
L<DBIx::Custom>.
cleanup
Yuki Kimoto authored on 2010-12-21
490

            
updated pod
Yuki Kimoto authored on 2011-06-07
491
=head2 C<one>
492

            
493
    my $row = $result->one;
494

            
495
This is alias for C<fetch_hash_first>.
496

            
- removed DEPRECATED DBIx::C...
Yuki Kimoto authored on 2011-04-11
497
=head2 C<remove_end_filter>
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
498

            
499
    $result->remove_end_filter;
500

            
501
Remove end filter.
502

            
- removed DEPRECATED DBIx::C...
Yuki Kimoto authored on 2011-04-11
503
=head2 C<remove_filter>
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
504

            
505
    $result->remove_filter;
506

            
507
Remove filter. End filter is not removed.
508

            
- removed DEPRECATED DBIx::C...
Yuki Kimoto authored on 2011-04-11
509
=head2 C<stash>
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-25
510

            
511
    my $stash = $result->stash;
512
    my $foo = $result->stash->{foo};
513
    $result->stash->{foo} = $foo;
514

            
515
Stash is hash reference to save your data.
516

            
packaging one directory
yuki-kimoto authored on 2009-11-16
517
=cut