Newer Older
526 lines | 11.243kb
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

            
updatedd pod
Yuki Kimoto authored on 2011-06-12
3
use Object::Simple -base;
cleanup
yuki-kimoto authored on 2010-02-11
4

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

            
updatedd pod
Yuki Kimoto authored on 2011-06-12
8
has [qw/filters filter_off sth type_rule type_rule_off/],
9
    stash => sub { {} };
cleanup
Yuki Kimoto authored on 2010-12-21
10

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

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

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

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

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

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
127
    return \@row;
128
}
129

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

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

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

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

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

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

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

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

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

            
cleanup
Yuki Kimoto authored on 2011-06-13
269
# DEPRECATED!
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
270
sub remove_end_filter {
271
    my $self = shift;
272
    
cleanup
Yuki Kimoto authored on 2011-06-13
273
    warn "remove_end_filter is DEPRECATED! use filter_off attribute instead";
274
    
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
275
    $self->{end_filter} = {};
276
    
277
    return $self;
278
}
279

            
cleanup
Yuki Kimoto authored on 2011-06-13
280
# DEPRECATED!
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
281
sub remove_filter {
282
    my $self = shift;
cleanup
Yuki Kimoto authored on 2011-06-13
283

            
284
    warn "remove_filter is DEPRECATED! use filter_off attribute instead";
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
285
    
286
    $self->{filter} = {};
287
    
288
    return $self;
289
}
290

            
cleanup
Yuki Kimoto authored on 2011-06-13
291
# DEPRECATED!
cleanup
Yuki Kimoto authored on 2011-01-12
292
sub default_filter {
293
    my $self = shift;
cleanup
Yuki Kimoto authored on 2011-06-13
294
    warn "default_filter is DEPRECATED!";
295
    return $self->_default_filter(@_)
296
}
297

            
298
# DEPRECATED!
299
sub _default_filter {
300
    my $self = shift;
301

            
cleanup
Yuki Kimoto authored on 2011-01-12
302
    
303
    if (@_) {
304
        my $fname = $_[0];
305
        if (@_ && !$fname) {
306
            $self->{default_filter} = undef;
307
        }
308
        else {
many changed
Yuki Kimoto authored on 2011-01-23
309
            croak qq{Filter "$fname" is not registered}
cleanup
Yuki Kimoto authored on 2011-01-12
310
              unless exists $self->filters->{$fname};
311
        
312
            $self->{default_filter} = $self->filters->{$fname};
313
        }
314
        
315
        return $self;
316
    }
317
    
318
    return $self->{default_filter};
319
}
320

            
cleanup
Yuki Kimoto authored on 2011-01-23
321
# DEPRECATED!
cleanup
Yuki Kimoto authored on 2011-06-13
322
has 'filter_check'; 
cleanup
Yuki Kimoto authored on 2011-01-23
323

            
update document
yuki-kimoto authored on 2010-01-30
324
1;
325

            
packaging one directory
yuki-kimoto authored on 2009-11-16
326
=head1 NAME
327

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

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

            
332
Get the result of select statement.
333

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

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

            
361
Fetch row into hash.
362

            
363
    # Fetch a row into hash
removed reconnect method
yuki-kimoto authored on 2010-05-28
364
    while (my $row = $result->fetch_hash) {
cleanup
yuki-kimoto authored on 2010-08-05
365
        my $title  = $row->{title};
366
        my $author = $row->{author};
removed reconnect method
yuki-kimoto authored on 2010-05-28
367
        
packaging one directory
yuki-kimoto authored on 2009-11-16
368
    }
removed reconnect method
yuki-kimoto authored on 2010-05-28
369
    
cleanup
yuki-kimoto authored on 2010-08-05
370
    # Fetch only a first row into hash
removed reconnect method
yuki-kimoto authored on 2010-05-28
371
    my $row = $result->fetch_hash_first;
372
    
373
    # Fetch multiple rows into array of hash
cleanup
yuki-kimoto authored on 2010-08-05
374
    while (my $rows = $result->fetch_hash_multi(5)) {
375
        my $first_title   = $rows->[0]{title};
376
        my $first_author  = $rows->[0]{author};
377
        my $second_title  = $rows->[1]{title};
378
        my $second_author = $rows->[1]{author};
removed reconnect method
yuki-kimoto authored on 2010-05-28
379
    }
380
    
381
    # Fetch all rows into array of hash
382
    my $rows = $result->fetch_hash_all;
packaging one directory
yuki-kimoto authored on 2009-11-16
383

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

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

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

            
391
    my $filter_off = $resutl->filter_off;
392
    $result = $result->filter_off(1);
393

            
394
Turn filter off.
395

            
cleanup
yuki-kimoto authored on 2010-10-17
396
=head2 C<filters>
397

            
398
    my $filters = $result->filters;
399
    $result     = $result->filters(\%filters);
400

            
401
Resistered filters.
402

            
403
=head2 C<sth>
404

            
405
    my $sth = $reuslt->sth
406
    $result = $result->sth($sth);
407

            
408
Statement handle of L<DBI>.
409

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

            
412
    my $type_rule_off = $result->type_rule_off;
413
    $result = $result->type_rule_off(1);
414

            
415
Turn type rule off.
416

            
update document
yuki-kimoto authored on 2010-01-30
417
=head1 METHODS
418

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

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

            
424
    my $rows = $result->all;
425

            
426
This is alias for C<fetch_hash_all>.
427

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

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

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

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

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

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

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

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

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

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

            
cleanup
yuki-kimoto authored on 2010-10-17
451
=head2 C<fetch_first>
452

            
453
    my $row = $result->fetch_first;
454

            
455
Fetch only a first row into array and finish statment handle.
456

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

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

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

            
cleanup
yuki-kimoto authored on 2010-10-17
463
=head2 C<fetch_hash_all>
464

            
465
    my $rows = $result->fetch_hash_all;
466

            
467
Fetch all rows into array of hash.
468

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

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

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

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

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

            
cleanup
yuki-kimoto authored on 2010-10-17
484
    my $rows = $result->fetch_multi(5);
485
    
486
Fetch multiple rows into array of array.
487
Row count must be specified.
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
488

            
cleanup
Yuki Kimoto authored on 2010-12-21
489
=head2 C<filter>
490

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

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

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

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

            
502
    my $row = $result->one;
503

            
504
This is alias for C<fetch_hash_first>.
505

            
cleanup
Yuki Kimoto authored on 2011-06-13
506
=head2 C<remove_end_filter> DEPRECATED!
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
507

            
508
    $result->remove_end_filter;
509

            
510
Remove end filter.
511

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

            
514
    $result->remove_filter;
515

            
516
Remove filter. End filter is not removed.
517

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

            
520
    my $stash = $result->stash;
521
    my $foo = $result->stash->{foo};
522
    $result->stash->{foo} = $foo;
523

            
524
Stash is hash reference to save your data.
525

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