Newer Older
510 lines | 10.83kb
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

            
cleanup
yuki-kimoto authored on 2010-10-17
380
=head2 C<filters>
381

            
382
    my $filters = $result->filters;
383
    $result     = $result->filters(\%filters);
384

            
385
Resistered filters.
386

            
387
=head2 C<sth>
388

            
389
    my $sth = $reuslt->sth
390
    $result = $result->sth($sth);
391

            
392
Statement handle of L<DBI>.
393

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

            
396
    my $type_rule_off = $result->type_rule_off;
397
    $result = $result->type_rule_off(1);
398

            
399
Turn type rule off.
400

            
update document
yuki-kimoto authored on 2010-01-30
401
=head1 METHODS
402

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

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

            
408
    my $rows = $result->all;
409

            
410
This is alias for C<fetch_hash_all>.
411

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

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

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

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

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

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

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

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

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

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

            
cleanup
yuki-kimoto authored on 2010-10-17
435
=head2 C<fetch_first>
436

            
437
    my $row = $result->fetch_first;
438

            
439
Fetch only a first row into array and finish statment handle.
440

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

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

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

            
cleanup
yuki-kimoto authored on 2010-10-17
447
=head2 C<fetch_hash_all>
448

            
449
    my $rows = $result->fetch_hash_all;
450

            
451
Fetch all rows into array of hash.
452

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

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

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

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

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

            
cleanup
yuki-kimoto authored on 2010-10-17
468
    my $rows = $result->fetch_multi(5);
469
    
470
Fetch multiple rows into array of array.
471
Row count must be specified.
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
472

            
cleanup
Yuki Kimoto authored on 2010-12-21
473
=head2 C<filter>
474

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

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

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

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

            
486
    my $row = $result->one;
487

            
488
This is alias for C<fetch_hash_first>.
489

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

            
492
    $result->remove_end_filter;
493

            
494
Remove end filter.
495

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

            
498
    $result->remove_filter;
499

            
500
Remove filter. End filter is not removed.
501

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

            
504
    my $stash = $result->stash;
505
    my $foo = $result->stash->{foo};
506
    $result->stash->{foo} = $foo;
507

            
508
Stash is hash reference to save your data.
509

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