Newer Older
544 lines | 12.09kb
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

            
added EXPERIMENTAL DBIx::Cus...
Yuki Kimoto authored on 2011-06-14
8
has [qw/filters filter_off sth type_rule_off/],
updatedd pod
Yuki Kimoto authored on 2011-06-12
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

            
packaging one directory
yuki-kimoto authored on 2009-11-16
50
sub fetch {
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
51
    my $self = shift;
52
    
packaging one directory
yuki-kimoto authored on 2009-11-16
53
    # Fetch
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
54
    my @row = $self->{sth}->fetchrow_array;
update document
yuki-kimoto authored on 2010-05-27
55
    return unless @row;
added check_filter attribute
yuki-kimoto authored on 2010-08-08
56
    
cleanup
yuki-kimoto authored on 2010-08-05
57
    # Filtering
added experimental iterate_a...
Yuki Kimoto authored on 2010-12-22
58
    my $columns = $self->{sth}->{NAME};
added type_rule method and f...
Yuki Kimoto authored on 2011-06-09
59
    my $types = $self->{sth}->{TYPE};
60
    my $type_rule = $self->type_rule || {};
separate DBIx::Custom::Resul...
Yuki Kimoto authored on 2011-06-15
61
    my $filter = $self->filter;
62
    my $end_filter = $self->end_filter;
cleanup
yuki-kimoto authored on 2010-08-05
63
    for (my $i = 0; $i < @$columns; $i++) {
added type_rule method and f...
Yuki Kimoto authored on 2011-06-09
64
        
separate DBIx::Custom::Resul...
Yuki Kimoto authored on 2011-06-15
65
        # Column
cleanup
yuki-kimoto authored on 2010-08-05
66
        my $column = $columns->[$i];
some changed
yuki-kimoto authored on 2010-05-02
67
        
separate DBIx::Custom::Resul...
Yuki Kimoto authored on 2011-06-15
68
        # Type rule
69
        my $type_filter = $type_rule->{lc($types->[$i])};
70
        $row[$i] = $type_filter->($row[$i])
71
          if $type_filter && !$self->{type_rule_off};
72
        
73
        # Filter
74
        my $filter  = $filter->{$column} || $self->{default_filter};
75
        $row[$i] = $filter->($row[$i])
76
          if $filter && !$self->{filter_off};
77
        $row[$i] = $end_filter->{$column}->($row[$i])
78
          if $end_filter->{$column} && !$self->{filter_off};
packaging one directory
yuki-kimoto authored on 2009-11-16
79
    }
many many changes
yuki-kimoto authored on 2010-04-30
80

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
81
    return \@row;
82
}
83

            
cleanup
yuki-kimoto authored on 2010-10-17
84
sub fetch_all {
85
    my $self = shift;
86
    
87
    # Fetch all rows
88
    my $rows = [];
89
    while(my $row = $self->fetch) {
90
        push @$rows, $row;
91
    }
92
    return $rows;
93
}
94

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
95
sub fetch_first {
96
    my $self = shift;
97
    
98
    # Fetch
99
    my $row = $self->fetch;
100
    
cleanup
yuki-kimoto authored on 2010-08-05
101
    # No row
removed reconnect method
yuki-kimoto authored on 2010-05-28
102
    return unless $row;
103
    
104
    # Finish statement handle
105
    $self->sth->finish;
106
    
107
    return $row;
108
}
109

            
packaging one directory
yuki-kimoto authored on 2009-11-16
110
sub fetch_hash {
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
111
    my $self = shift;
112
    
packaging one directory
yuki-kimoto authored on 2009-11-16
113
    # Fetch
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
114
    my $row = $self->{sth}->fetchrow_arrayref;
packaging one directory
yuki-kimoto authored on 2009-11-16
115
    return unless $row;
added check_filter attribute
yuki-kimoto authored on 2010-08-08
116

            
packaging one directory
yuki-kimoto authored on 2009-11-16
117
    # Filter
separate DBIx::Custom::Resul...
Yuki Kimoto authored on 2011-06-15
118
    my $hash_row = {};
119
    my $filter  = $self->filter;
120
    my $end_filter = $self->end_filter || {};
added experimental iterate_a...
Yuki Kimoto authored on 2010-12-22
121
    my $columns = $self->{sth}->{NAME};
added type_rule method and f...
Yuki Kimoto authored on 2011-06-09
122
    my $types = $self->{sth}->{TYPE};
123
    my $type_rule = $self->type_rule || {};
cleanup
yuki-kimoto authored on 2010-08-05
124
    for (my $i = 0; $i < @$columns; $i++) {
update document
yuki-kimoto authored on 2010-05-27
125
        
separate DBIx::Custom::Resul...
Yuki Kimoto authored on 2011-06-15
126
        # Column
cleanup
yuki-kimoto authored on 2010-08-05
127
        my $column = $columns->[$i];
add query filter error check
yuki-kimoto authored on 2010-05-14
128
        
separate DBIx::Custom::Resul...
Yuki Kimoto authored on 2011-06-15
129
        # Type rule
130
        my $type_filter = $type_rule->{lc($types->[$i])};
131
        if (!$self->{type_rule_off} && $type_filter) {
132
            $hash_row->{$column} = $type_filter->($row->[$i]);
DBIx::Custom::Result filter ...
Yuki Kimoto authored on 2011-06-14
133
        }
separate DBIx::Custom::Resul...
Yuki Kimoto authored on 2011-06-15
134
        else { $hash_row->{$column} = $row->[$i] }
135
        
136
        # Filter
137
        my $f = $filter->{$column} || $self->{default_filter};
138
        $hash_row->{$column} = $f->($hash_row->{$column})
139
          if $f && !$self->{filter_off};
140
        $hash_row->{$column} = $end_filter->{$column}->($hash_row->{$column})
141
          if $end_filter->{$column} && !$self->{filter_off};
packaging one directory
yuki-kimoto authored on 2009-11-16
142
    }
143
    
separate DBIx::Custom::Resul...
Yuki Kimoto authored on 2011-06-15
144
    return $hash_row;
packaging one directory
yuki-kimoto authored on 2009-11-16
145
}
146

            
cleanup
yuki-kimoto authored on 2010-10-17
147
sub fetch_hash_all {
148
    my $self = shift;
149
    
150
    # Fetch all rows as hash
151
    my $rows = [];
152
    while(my $row = $self->fetch_hash) {
153
        push @$rows, $row;
154
    }
155
    
156
    return $rows;
157
}
158

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
159
sub fetch_hash_first {
packaging one directory
yuki-kimoto authored on 2009-11-16
160
    my $self = shift;
161
    
162
    # Fetch hash
163
    my $row = $self->fetch_hash;
164
    
cleanup
yuki-kimoto authored on 2010-08-05
165
    # No row
packaging one directory
yuki-kimoto authored on 2009-11-16
166
    return unless $row;
167
    
168
    # Finish statement handle
some changed
yuki-kimoto authored on 2010-05-02
169
    $self->sth->finish;
packaging one directory
yuki-kimoto authored on 2009-11-16
170
    
removed reconnect method
yuki-kimoto authored on 2010-05-28
171
    return $row;
packaging one directory
yuki-kimoto authored on 2009-11-16
172
}
173

            
renamed fetch_rows to fetch_...
yuki-kimoto authored on 2010-05-01
174
sub fetch_hash_multi {
packaging one directory
yuki-kimoto authored on 2009-11-16
175
    my ($self, $count) = @_;
176
    
cleanup
yuki-kimoto authored on 2010-08-05
177
    # Row count not specified
cleanup
Yuki Kimoto authored on 2011-04-25
178
    croak 'Row count must be specified ' . _subname
packaging one directory
yuki-kimoto authored on 2009-11-16
179
      unless $count;
180
    
181
    # Fetch multi rows
182
    my $rows = [];
183
    for (my $i = 0; $i < $count; $i++) {
removed reconnect method
yuki-kimoto authored on 2010-05-28
184
        my $row = $self->fetch_hash;
185
        last unless $row;
186
        push @$rows, $row;
packaging one directory
yuki-kimoto authored on 2009-11-16
187
    }
188
    
189
    return unless @$rows;
removed reconnect method
yuki-kimoto authored on 2010-05-28
190
    return $rows;
packaging one directory
yuki-kimoto authored on 2009-11-16
191
}
192

            
cleanup
yuki-kimoto authored on 2010-10-17
193
sub fetch_multi {
194
    my ($self, $count) = @_;
packaging one directory
yuki-kimoto authored on 2009-11-16
195
    
cleanup
yuki-kimoto authored on 2010-10-17
196
    # Row count not specifed
cleanup
Yuki Kimoto authored on 2011-04-25
197
    croak 'Row count must be specified ' . _subname
cleanup
yuki-kimoto authored on 2010-10-17
198
      unless $count;
199
    
200
    # Fetch multi rows
packaging one directory
yuki-kimoto authored on 2009-11-16
201
    my $rows = [];
cleanup
yuki-kimoto authored on 2010-10-17
202
    for (my $i = 0; $i < $count; $i++) {
203
        my $row = $self->fetch;
204
        last unless $row;
removed reconnect method
yuki-kimoto authored on 2010-05-28
205
        push @$rows, $row;
packaging one directory
yuki-kimoto authored on 2009-11-16
206
    }
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
207
    
cleanup
yuki-kimoto authored on 2010-10-17
208
    return unless @$rows;
removed reconnect method
yuki-kimoto authored on 2010-05-28
209
    return $rows;
packaging one directory
yuki-kimoto authored on 2009-11-16
210
}
211

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

            
added EXPERIMENTAL DBIx::Cus...
Yuki Kimoto authored on 2011-06-14
214
sub type_rule {
215
    my $self = shift;
216
    
217
    # Merge type rule
218
    if (@_) {
219
        my $type_rule = @_ == 1 ? $_[0] : [@_];
220
        $type_rule = _array_to_hash($type_rule) || {};
221
        foreach my $data_type (keys %{$type_rule || {}}) {
222
            croak qq{data type of into section must be lower case or number}
223
              if $data_type =~ /[A-Z]/;
224
            my $fname = $type_rule->{$data_type};
225
            if (defined $fname && ref $fname ne 'CODE') {
226
                croak qq{Filter "$fname" is not registered" } . _subname
227
                  unless exists $self->filters->{$fname};
228
                
229
                $type_rule->{$data_type} = $self->filters->{$fname};
230
            }
231
        }
232
        $self->{type_rule} = {%{$self->type_rule}, %$type_rule};
233
    }
234
    
235
    return $self->{type_rule} ||= {};
236
}
237

            
238
sub clear_type_rule {
239
    my $self = shift;
240
    $self->{type_rule} = {};
241
    return $self;
242
}
243

            
cleanup
Yuki Kimoto authored on 2011-06-13
244
# DEPRECATED!
245
sub end_filter {
246
    my $self = shift;
247
    
248
    if (@_) {
249
        my $end_filter = {};
250
        
251
        if (ref $_[0] eq 'HASH') {
252
            $end_filter = $_[0];
253
        }
254
        else {
255
            $end_filter = _array_to_hash(
256
                @_ > 1 ? [@_] : $_[0]
257
            );
258
        }
259
        
260
        foreach my $column (keys %$end_filter) {
261
            my $fname = $end_filter->{$column};
262
            
263
            if  (exists $end_filter->{$column}
264
              && defined $fname
265
              && ref $fname ne 'CODE') 
266
            {
267
              croak qq{Filter "$fname" is not registered" } . _subname
268
                unless exists $self->filters->{$fname};
269
              
270
              $end_filter->{$column} = $self->filters->{$fname};
271
            }
272
        }
273
        
274
        $self->{end_filter} = {%{$self->end_filter}, %$end_filter};
275
        
276
        return $self;
277
    }
278
    
279
    return $self->{end_filter} ||= {};
280
}
281

            
cleanup
Yuki Kimoto authored on 2011-06-13
282
# DEPRECATED!
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
283
sub remove_end_filter {
284
    my $self = shift;
285
    
cleanup
Yuki Kimoto authored on 2011-06-13
286
    warn "remove_end_filter is DEPRECATED! use filter_off attribute instead";
287
    
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
288
    $self->{end_filter} = {};
289
    
290
    return $self;
291
}
292

            
cleanup
Yuki Kimoto authored on 2011-06-13
293
# DEPRECATED!
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
294
sub remove_filter {
295
    my $self = shift;
cleanup
Yuki Kimoto authored on 2011-06-13
296

            
297
    warn "remove_filter is DEPRECATED! use filter_off attribute instead";
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
298
    
299
    $self->{filter} = {};
300
    
301
    return $self;
302
}
303

            
cleanup
Yuki Kimoto authored on 2011-06-13
304
# DEPRECATED!
cleanup
Yuki Kimoto authored on 2011-01-12
305
sub default_filter {
306
    my $self = shift;
cleanup
Yuki Kimoto authored on 2011-06-13
307

            
cleanup
Yuki Kimoto authored on 2011-06-13
308
    warn "default_filter is DEPRECATED!";
cleanup
Yuki Kimoto authored on 2011-01-12
309
    
310
    if (@_) {
311
        my $fname = $_[0];
312
        if (@_ && !$fname) {
313
            $self->{default_filter} = undef;
314
        }
315
        else {
many changed
Yuki Kimoto authored on 2011-01-23
316
            croak qq{Filter "$fname" is not registered}
cleanup
Yuki Kimoto authored on 2011-01-12
317
              unless exists $self->filters->{$fname};
318
        
319
            $self->{default_filter} = $self->filters->{$fname};
320
        }
321
        
322
        return $self;
323
    }
324
    
325
    return $self->{default_filter};
326
}
327

            
cleanup
Yuki Kimoto authored on 2011-01-23
328
# DEPRECATED!
cleanup
Yuki Kimoto authored on 2011-06-13
329
has 'filter_check'; 
cleanup
Yuki Kimoto authored on 2011-01-23
330

            
update document
yuki-kimoto authored on 2010-01-30
331
1;
332

            
packaging one directory
yuki-kimoto authored on 2009-11-16
333
=head1 NAME
334

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

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

            
339
Get the result of select statement.
340

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

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

            
368
Fetch row into hash.
369

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

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

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

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

            
398
    my $filter_off = $resutl->filter_off;
399
    $result = $result->filter_off(1);
400

            
401
Turn filter off.
402

            
cleanup
yuki-kimoto authored on 2010-10-17
403
=head2 C<filters>
404

            
405
    my $filters = $result->filters;
406
    $result     = $result->filters(\%filters);
407

            
408
Resistered filters.
409

            
410
=head2 C<sth>
411

            
412
    my $sth = $reuslt->sth
413
    $result = $result->sth($sth);
414

            
415
Statement handle of L<DBI>.
416

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

            
419
    my $type_rule_off = $result->type_rule_off;
420
    $result = $result->type_rule_off(1);
421

            
422
Turn type rule off.
423

            
update document
yuki-kimoto authored on 2010-01-30
424
=head1 METHODS
425

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

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

            
431
    my $rows = $result->all;
432

            
433
This is alias for C<fetch_hash_all>.
434

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

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

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

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

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

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

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

            
449
    my $row = $result->fetch_first;
450

            
451
Fetch only a first row into array and finish statment handle.
452

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

            
cleanup
yuki-kimoto authored on 2010-08-05
455
    my $row = $result->fetch_hash;
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 a row into hash
update document
yuki-kimoto authored on 2009-11-19
458

            
cleanup
yuki-kimoto authored on 2010-10-17
459
=head2 C<fetch_hash_all>
460

            
461
    my $rows = $result->fetch_hash_all;
462

            
463
Fetch all rows into array of hash.
464

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

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

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

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

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

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

            
cleanup
Yuki Kimoto authored on 2010-12-21
485
=head2 C<filter>
486

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

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

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

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

            
498
    my $row = $result->one;
499

            
500
This is alias for C<fetch_hash_first>.
501

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

            
504
    $result->remove_filter;
505

            
506
Remove filter. End filter is not removed.
507

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

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

            
514
Stash is hash reference to save your data.
515

            
added EXPERIMENTAL DBIx::Cus...
Yuki Kimoto authored on 2011-06-14
516
=head2 C<type_rule> EXPERIMENTAL
517

            
518
    $result->type_rule(
519
        # DATE
520
        9 => sub { ... },
521
        # DATETIME or TIMESTAMP
522
        11 => sub { ... }
523
    );
524

            
525
This override L<DBIx::Custom>'s C<type_rule> C<from> section.
526

            
EXPERIMENTAL type_rule_off i...
Yuki Kimoto authored on 2011-06-14
527
=head2 C<remove_end_filter> DEPRECATED!
528

            
529
    $result->remove_end_filter;
530

            
531
Remove end filter.
532

            
533
=head2 C<end_filter> DEPRECATED!
534

            
535
    $result = $result->end_filter(title  => 'to_something',
536
                                     author => 'to_something');
537

            
538
    $result = $result->end_filter([qw/title author/] => 'to_something');
539

            
540
End filters.
541
These each filters is executed after the filters applied by C<apply_filter> of
542
L<DBIx::Custom> or C<filter> method.
543

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