Newer Older
559 lines | 12.239kb
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
    
cleanup
Yuki Kimoto authored on 2011-01-12
53
    # Filter
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
54
    my $filter = $self->filter;
55
    
56
    # End filter
cleanup
Yuki Kimoto authored on 2011-06-13
57
    my $end_filter = $self->{end_filter} || {};
packaging one directory
yuki-kimoto authored on 2009-11-16
58
    
59
    # Fetch
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
60
    my @row = $self->{sth}->fetchrow_array;
packaging one directory
yuki-kimoto authored on 2009-11-16
61
    
cleanup
yuki-kimoto authored on 2010-08-05
62
    # No row
update document
yuki-kimoto authored on 2010-05-27
63
    return unless @row;
added check_filter attribute
yuki-kimoto authored on 2010-08-08
64
    
cleanup
yuki-kimoto authored on 2010-08-05
65
    # Filtering
added experimental iterate_a...
Yuki Kimoto authored on 2010-12-22
66
    my $columns = $self->{sth}->{NAME};
added type_rule method and f...
Yuki Kimoto authored on 2011-06-09
67
    my $types = $self->{sth}->{TYPE};
68
    my $type_rule = $self->type_rule || {};
69
    
cleanup
yuki-kimoto authored on 2010-08-05
70
    for (my $i = 0; $i < @$columns; $i++) {
added EXPERIMENTAL DBIx::Cus...
Yuki Kimoto authored on 2011-06-14
71
        if (!$self->type_rule_off && (my $rule = $type_rule->{lc($types->[$i])}))
added type_rule method and f...
Yuki Kimoto authored on 2011-06-09
72
        {
73
            $row[$i] = $rule->($row[$i]);
74
        }
75
        
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
76
        # Filter name
cleanup
yuki-kimoto authored on 2010-08-05
77
        my $column = $columns->[$i];
cleanup
Yuki Kimoto authored on 2010-12-21
78
        my $f  = exists $filter->{$column}
79
               ? $filter->{$column}
cleanup
Yuki Kimoto authored on 2011-06-13
80
               : $self->{default_filter};
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
81
        my $ef = $end_filter->{$column};
some changed
yuki-kimoto authored on 2010-05-02
82
        
cleanup
yuki-kimoto authored on 2010-08-05
83
        # Filtering
type_rule can receive filter...
Yuki Kimoto authored on 2011-06-12
84
        $row[$i] = $f->($row[$i]) if $f && !$self->filter_off;
85
        $row[$i] = $ef->($row[$i]) if $ef && !$self->filter_off;
packaging one directory
yuki-kimoto authored on 2009-11-16
86
    }
many many changes
yuki-kimoto authored on 2010-04-30
87

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
88
    return \@row;
89
}
90

            
cleanup
yuki-kimoto authored on 2010-10-17
91
sub fetch_all {
92
    my $self = shift;
93
    
94
    # Fetch all rows
95
    my $rows = [];
96
    while(my $row = $self->fetch) {
97
        push @$rows, $row;
98
    }
99
    return $rows;
100
}
101

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
102
sub fetch_first {
103
    my $self = shift;
104
    
105
    # Fetch
106
    my $row = $self->fetch;
107
    
cleanup
yuki-kimoto authored on 2010-08-05
108
    # No row
removed reconnect method
yuki-kimoto authored on 2010-05-28
109
    return unless $row;
110
    
111
    # Finish statement handle
112
    $self->sth->finish;
113
    
114
    return $row;
115
}
116

            
packaging one directory
yuki-kimoto authored on 2009-11-16
117
sub fetch_hash {
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
118
    my $self = shift;
119
    
cleanup
Yuki Kimoto authored on 2011-01-12
120
    # Filter
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
121
    my $filter  = $self->filter;
122
    
123
    # End filter
cleanup
Yuki Kimoto authored on 2011-06-13
124
    my $end_filter = $self->{end_filter} || {};
packaging one directory
yuki-kimoto authored on 2009-11-16
125
    
126
    # Fetch
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
127
    my $row = $self->{sth}->fetchrow_arrayref;
packaging one directory
yuki-kimoto authored on 2009-11-16
128
    
129
    # Cannot fetch
130
    return unless $row;
added check_filter attribute
yuki-kimoto authored on 2010-08-08
131

            
packaging one directory
yuki-kimoto authored on 2009-11-16
132
    # Filter
133
    my $row_hash = {};
added experimental iterate_a...
Yuki Kimoto authored on 2010-12-22
134
    my $columns = $self->{sth}->{NAME};
added type_rule method and f...
Yuki Kimoto authored on 2011-06-09
135
    my $types = $self->{sth}->{TYPE};
136
    my $type_rule = $self->type_rule || {};
cleanup
yuki-kimoto authored on 2010-08-05
137
    for (my $i = 0; $i < @$columns; $i++) {
update document
yuki-kimoto authored on 2010-05-27
138
        
added type_rule method and f...
Yuki Kimoto authored on 2011-06-09
139
        # Type rule
added EXPERIMENTAL DBIx::Cus...
Yuki Kimoto authored on 2011-06-14
140
        if (!$self->type_rule_off && (my $rule = $type_rule->{lc($types->[$i])}))
added type_rule method and f...
Yuki Kimoto authored on 2011-06-09
141
        {
142
            $row->[$i] = $rule->($row->[$i]);
143
        }
144
        
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
145
        # Filter name
cleanup
yuki-kimoto authored on 2010-08-05
146
        my $column = $columns->[$i];
cleanup
Yuki Kimoto authored on 2010-12-21
147
        my $f  = exists $filter->{$column}
148
               ? $filter->{$column}
cleanup
Yuki Kimoto authored on 2011-06-13
149
               : $self->{default_filter};
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
150
        my $ef = $end_filter->{$column};
add query filter error check
yuki-kimoto authored on 2010-05-14
151
        
cleanup
yuki-kimoto authored on 2010-08-05
152
        # Filtering
type_rule can receive filter...
Yuki Kimoto authored on 2011-06-12
153
        $row_hash->{$column} = $f && !$self->filter_off ? $f->($row->[$i])
154
                                                        : $row->[$i];
155
        $row_hash->{$column} = $ef->($row_hash->{$column})
156
          if $ef && !$self->filter_off;
packaging one directory
yuki-kimoto authored on 2009-11-16
157
    }
158
    
removed reconnect method
yuki-kimoto authored on 2010-05-28
159
    return $row_hash;
packaging one directory
yuki-kimoto authored on 2009-11-16
160
}
161

            
cleanup
yuki-kimoto authored on 2010-10-17
162
sub fetch_hash_all {
163
    my $self = shift;
164
    
165
    # Fetch all rows as hash
166
    my $rows = [];
167
    while(my $row = $self->fetch_hash) {
168
        push @$rows, $row;
169
    }
170
    
171
    return $rows;
172
}
173

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
174
sub fetch_hash_first {
packaging one directory
yuki-kimoto authored on 2009-11-16
175
    my $self = shift;
176
    
177
    # Fetch hash
178
    my $row = $self->fetch_hash;
179
    
cleanup
yuki-kimoto authored on 2010-08-05
180
    # No row
packaging one directory
yuki-kimoto authored on 2009-11-16
181
    return unless $row;
182
    
183
    # Finish statement handle
some changed
yuki-kimoto authored on 2010-05-02
184
    $self->sth->finish;
packaging one directory
yuki-kimoto authored on 2009-11-16
185
    
removed reconnect method
yuki-kimoto authored on 2010-05-28
186
    return $row;
packaging one directory
yuki-kimoto authored on 2009-11-16
187
}
188

            
renamed fetch_rows to fetch_...
yuki-kimoto authored on 2010-05-01
189
sub fetch_hash_multi {
packaging one directory
yuki-kimoto authored on 2009-11-16
190
    my ($self, $count) = @_;
191
    
cleanup
yuki-kimoto authored on 2010-08-05
192
    # Row count not specified
cleanup
Yuki Kimoto authored on 2011-04-25
193
    croak 'Row count must be specified ' . _subname
packaging one directory
yuki-kimoto authored on 2009-11-16
194
      unless $count;
195
    
196
    # Fetch multi rows
197
    my $rows = [];
198
    for (my $i = 0; $i < $count; $i++) {
removed reconnect method
yuki-kimoto authored on 2010-05-28
199
        my $row = $self->fetch_hash;
200
        last unless $row;
201
        push @$rows, $row;
packaging one directory
yuki-kimoto authored on 2009-11-16
202
    }
203
    
204
    return unless @$rows;
removed reconnect method
yuki-kimoto authored on 2010-05-28
205
    return $rows;
packaging one directory
yuki-kimoto authored on 2009-11-16
206
}
207

            
cleanup
yuki-kimoto authored on 2010-10-17
208
sub fetch_multi {
209
    my ($self, $count) = @_;
packaging one directory
yuki-kimoto authored on 2009-11-16
210
    
cleanup
yuki-kimoto authored on 2010-10-17
211
    # Row count not specifed
cleanup
Yuki Kimoto authored on 2011-04-25
212
    croak 'Row count must be specified ' . _subname
cleanup
yuki-kimoto authored on 2010-10-17
213
      unless $count;
214
    
215
    # Fetch multi rows
packaging one directory
yuki-kimoto authored on 2009-11-16
216
    my $rows = [];
cleanup
yuki-kimoto authored on 2010-10-17
217
    for (my $i = 0; $i < $count; $i++) {
218
        my $row = $self->fetch;
219
        last unless $row;
removed reconnect method
yuki-kimoto authored on 2010-05-28
220
        push @$rows, $row;
packaging one directory
yuki-kimoto authored on 2009-11-16
221
    }
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
222
    
cleanup
yuki-kimoto authored on 2010-10-17
223
    return unless @$rows;
removed reconnect method
yuki-kimoto authored on 2010-05-28
224
    return $rows;
packaging one directory
yuki-kimoto authored on 2009-11-16
225
}
226

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

            
added EXPERIMENTAL DBIx::Cus...
Yuki Kimoto authored on 2011-06-14
229
sub type_rule {
230
    my $self = shift;
231
    
232
    # Merge type rule
233
    if (@_) {
234
        my $type_rule = @_ == 1 ? $_[0] : [@_];
235
        $type_rule = _array_to_hash($type_rule) || {};
236
        foreach my $data_type (keys %{$type_rule || {}}) {
237
            croak qq{data type of into section must be lower case or number}
238
              if $data_type =~ /[A-Z]/;
239
            my $fname = $type_rule->{$data_type};
240
            if (defined $fname && ref $fname ne 'CODE') {
241
                croak qq{Filter "$fname" is not registered" } . _subname
242
                  unless exists $self->filters->{$fname};
243
                
244
                $type_rule->{$data_type} = $self->filters->{$fname};
245
            }
246
        }
247
        $self->{type_rule} = {%{$self->type_rule}, %$type_rule};
248
    }
249
    
250
    return $self->{type_rule} ||= {};
251
}
252

            
253
sub clear_type_rule {
254
    my $self = shift;
255
    $self->{type_rule} = {};
256
    return $self;
257
}
258

            
cleanup
Yuki Kimoto authored on 2011-06-13
259
# DEPRECATED!
260
sub end_filter {
261
    my $self = shift;
262
    
263
    if (@_) {
264
        my $end_filter = {};
265
        
266
        if (ref $_[0] eq 'HASH') {
267
            $end_filter = $_[0];
268
        }
269
        else {
270
            $end_filter = _array_to_hash(
271
                @_ > 1 ? [@_] : $_[0]
272
            );
273
        }
274
        
275
        foreach my $column (keys %$end_filter) {
276
            my $fname = $end_filter->{$column};
277
            
278
            if  (exists $end_filter->{$column}
279
              && defined $fname
280
              && ref $fname ne 'CODE') 
281
            {
282
              croak qq{Filter "$fname" is not registered" } . _subname
283
                unless exists $self->filters->{$fname};
284
              
285
              $end_filter->{$column} = $self->filters->{$fname};
286
            }
287
        }
288
        
289
        $self->{end_filter} = {%{$self->end_filter}, %$end_filter};
290
        
291
        return $self;
292
    }
293
    
294
    return $self->{end_filter} ||= {};
295
}
296

            
cleanup
Yuki Kimoto authored on 2011-06-13
297
# DEPRECATED!
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
298
sub remove_end_filter {
299
    my $self = shift;
300
    
cleanup
Yuki Kimoto authored on 2011-06-13
301
    warn "remove_end_filter is DEPRECATED! use filter_off attribute instead";
302
    
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
303
    $self->{end_filter} = {};
304
    
305
    return $self;
306
}
307

            
cleanup
Yuki Kimoto authored on 2011-06-13
308
# DEPRECATED!
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
309
sub remove_filter {
310
    my $self = shift;
cleanup
Yuki Kimoto authored on 2011-06-13
311

            
312
    warn "remove_filter is DEPRECATED! use filter_off attribute instead";
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
313
    
314
    $self->{filter} = {};
315
    
316
    return $self;
317
}
318

            
cleanup
Yuki Kimoto authored on 2011-06-13
319
# DEPRECATED!
cleanup
Yuki Kimoto authored on 2011-01-12
320
sub default_filter {
321
    my $self = shift;
cleanup
Yuki Kimoto authored on 2011-06-13
322

            
cleanup
Yuki Kimoto authored on 2011-06-13
323
    warn "default_filter is DEPRECATED!";
cleanup
Yuki Kimoto authored on 2011-01-12
324
    
325
    if (@_) {
326
        my $fname = $_[0];
327
        if (@_ && !$fname) {
328
            $self->{default_filter} = undef;
329
        }
330
        else {
many changed
Yuki Kimoto authored on 2011-01-23
331
            croak qq{Filter "$fname" is not registered}
cleanup
Yuki Kimoto authored on 2011-01-12
332
              unless exists $self->filters->{$fname};
333
        
334
            $self->{default_filter} = $self->filters->{$fname};
335
        }
336
        
337
        return $self;
338
    }
339
    
340
    return $self->{default_filter};
341
}
342

            
cleanup
Yuki Kimoto authored on 2011-01-23
343
# DEPRECATED!
cleanup
Yuki Kimoto authored on 2011-06-13
344
has 'filter_check'; 
cleanup
Yuki Kimoto authored on 2011-01-23
345

            
update document
yuki-kimoto authored on 2010-01-30
346
1;
347

            
packaging one directory
yuki-kimoto authored on 2009-11-16
348
=head1 NAME
349

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

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

            
354
Get the result of select statement.
355

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

            
359
Fetch row into array.
removed reconnect method
yuki-kimoto authored on 2010-05-28
360
    
361
    # Fetch a row into array
362
    while (my $row = $result->fetch) {
cleanup
yuki-kimoto authored on 2010-08-05
363
        my $author = $row->[0];
364
        my $title  = $row->[1];
removed reconnect method
yuki-kimoto authored on 2010-05-28
365
        
version 0.0901
yuki-kimoto authored on 2009-12-17
366
    }
367
    
cleanup
yuki-kimoto authored on 2010-08-05
368
    # Fetch only a first row into array
removed reconnect method
yuki-kimoto authored on 2010-05-28
369
    my $row = $result->fetch_first;
370
    
371
    # Fetch multiple rows into array of array
372
    while (my $rows = $result->fetch_multi(5)) {
cleanup
yuki-kimoto authored on 2010-08-05
373
        my $first_author  = $rows->[0][0];
374
        my $first_title   = $rows->[0][1];
375
        my $second_author = $rows->[1][0];
376
        my $second_value  = $rows->[1][1];
377
    
removed reconnect method
yuki-kimoto authored on 2010-05-28
378
    }
379
    
380
    # Fetch all rows into array of array
381
    my $rows = $result->fetch_all;
cleanup
yuki-kimoto authored on 2010-08-05
382

            
383
Fetch row into hash.
384

            
385
    # Fetch a row into hash
removed reconnect method
yuki-kimoto authored on 2010-05-28
386
    while (my $row = $result->fetch_hash) {
cleanup
yuki-kimoto authored on 2010-08-05
387
        my $title  = $row->{title};
388
        my $author = $row->{author};
removed reconnect method
yuki-kimoto authored on 2010-05-28
389
        
packaging one directory
yuki-kimoto authored on 2009-11-16
390
    }
removed reconnect method
yuki-kimoto authored on 2010-05-28
391
    
cleanup
yuki-kimoto authored on 2010-08-05
392
    # Fetch only a first row into hash
removed reconnect method
yuki-kimoto authored on 2010-05-28
393
    my $row = $result->fetch_hash_first;
394
    
395
    # Fetch multiple rows into array of hash
cleanup
yuki-kimoto authored on 2010-08-05
396
    while (my $rows = $result->fetch_hash_multi(5)) {
397
        my $first_title   = $rows->[0]{title};
398
        my $first_author  = $rows->[0]{author};
399
        my $second_title  = $rows->[1]{title};
400
        my $second_author = $rows->[1]{author};
removed reconnect method
yuki-kimoto authored on 2010-05-28
401
    }
402
    
403
    # Fetch all rows into array of hash
404
    my $rows = $result->fetch_hash_all;
packaging one directory
yuki-kimoto authored on 2009-11-16
405

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

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

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

            
413
    my $filter_off = $resutl->filter_off;
414
    $result = $result->filter_off(1);
415

            
416
Turn filter off.
417

            
cleanup
yuki-kimoto authored on 2010-10-17
418
=head2 C<filters>
419

            
420
    my $filters = $result->filters;
421
    $result     = $result->filters(\%filters);
422

            
423
Resistered filters.
424

            
425
=head2 C<sth>
426

            
427
    my $sth = $reuslt->sth
428
    $result = $result->sth($sth);
429

            
430
Statement handle of L<DBI>.
431

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

            
434
    my $type_rule_off = $result->type_rule_off;
435
    $result = $result->type_rule_off(1);
436

            
437
Turn type rule off.
438

            
update document
yuki-kimoto authored on 2010-01-30
439
=head1 METHODS
440

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

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

            
446
    my $rows = $result->all;
447

            
448
This is alias for C<fetch_hash_all>.
449

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

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

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

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

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

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

            
cleanup
yuki-kimoto authored on 2010-10-17
462
=head2 C<fetch_first>
463

            
464
    my $row = $result->fetch_first;
465

            
466
Fetch only a first row into array and finish statment handle.
467

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

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

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

            
cleanup
yuki-kimoto authored on 2010-10-17
474
=head2 C<fetch_hash_all>
475

            
476
    my $rows = $result->fetch_hash_all;
477

            
478
Fetch all rows into array of hash.
479

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

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

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

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

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

            
cleanup
yuki-kimoto authored on 2010-10-17
495
    my $rows = $result->fetch_multi(5);
496
    
497
Fetch multiple rows into array of array.
498
Row count must be specified.
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
499

            
cleanup
Yuki Kimoto authored on 2010-12-21
500
=head2 C<filter>
501

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

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

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

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

            
513
    my $row = $result->one;
514

            
515
This is alias for C<fetch_hash_first>.
516

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

            
519
    $result->remove_filter;
520

            
521
Remove filter. End filter is not removed.
522

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

            
525
    my $stash = $result->stash;
526
    my $foo = $result->stash->{foo};
527
    $result->stash->{foo} = $foo;
528

            
529
Stash is hash reference to save your data.
530

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

            
533
    $result->type_rule(
534
        # DATE
535
        9 => sub { ... },
536
        # DATETIME or TIMESTAMP
537
        11 => sub { ... }
538
    );
539

            
540
This override L<DBIx::Custom>'s C<type_rule> C<from> section.
541

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

            
544
    $result->remove_end_filter;
545

            
546
Remove end filter.
547

            
548
=head2 C<end_filter> DEPRECATED!
549

            
550
    $result = $result->end_filter(title  => 'to_something',
551
                                     author => 'to_something');
552

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

            
555
End filters.
556
These each filters is executed after the filters applied by C<apply_filter> of
557
L<DBIx::Custom> or C<filter> method.
558

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