Newer Older
464 lines | 11.026kb
packaging one directory
yuki-kimoto authored on 2009-11-16
1
package DBIx::Custom::Result;
updatedd pod
Yuki Kimoto authored on 2011-06-12
2
use Object::Simple -base;
cleanup
yuki-kimoto authored on 2010-02-11
3

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

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

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

            
cleanup
Yuki Kimoto authored on 2010-12-21
12
sub filter {
13
    my $self = shift;
cleanup
Yuki Kimoto authored on 2010-12-22
14
    
cleanup
Yuki Kimoto authored on 2011-06-15
15
    # Set
cleanup
Yuki Kimoto authored on 2010-12-22
16
    if (@_) {
17
        
cleanup
Yuki Kimoto authored on 2011-06-15
18
        # Convert filter name to subroutine
19
        my $filter = @_ == 1 ? $_[0] : [@_];
20
        $filter = _array_to_hash($filter);
cleanup
Yuki Kimoto authored on 2010-12-22
21
        foreach my $column (keys %$filter) {
22
            my $fname = $filter->{$column};
fix bug : filter can't over...
Yuki Kimoto authored on 2011-02-09
23
            if  (exists $filter->{$column}
24
              && defined $fname
25
              && ref $fname ne 'CODE') 
26
            {
cleanup
Yuki Kimoto authored on 2011-04-25
27
              croak qq{Filter "$fname" is not registered" } . _subname
cleanup
Yuki Kimoto authored on 2010-12-22
28
                unless exists $self->filters->{$fname};
29
              $filter->{$column} = $self->filters->{$fname};
30
            }
cleanup
Yuki Kimoto authored on 2010-12-21
31
        }
cleanup
Yuki Kimoto authored on 2010-12-22
32
        
cleanup
Yuki Kimoto authored on 2011-06-15
33
        # Merge
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
34
        $self->{filter} = {%{$self->filter}, %$filter};
cleanup
Yuki Kimoto authored on 2010-12-22
35
        
36
        return $self;
cleanup
Yuki Kimoto authored on 2010-12-21
37
    }
38
    
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
39
    return $self->{filter} ||= {};
40
}
41

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

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
73
    return \@row;
74
}
75

            
cleanup
yuki-kimoto authored on 2010-10-17
76
sub fetch_all {
77
    my $self = shift;
78
    
79
    # Fetch all rows
80
    my $rows = [];
cleanup
Yuki Kimoto authored on 2011-06-15
81
    while(my $row = $self->fetch) { push @$rows, $row}
82
    
cleanup
yuki-kimoto authored on 2010-10-17
83
    return $rows;
84
}
85

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
86
sub fetch_first {
87
    my $self = shift;
88
    
89
    # Fetch
90
    my $row = $self->fetch;
91
    return unless $row;
92
    
93
    # Finish statement handle
94
    $self->sth->finish;
95
    
96
    return $row;
97
}
98

            
packaging one directory
yuki-kimoto authored on 2009-11-16
99
sub fetch_hash {
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
100
    my $self = shift;
101
    
packaging one directory
yuki-kimoto authored on 2009-11-16
102
    # Fetch
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
103
    my $row = $self->{sth}->fetchrow_arrayref;
packaging one directory
yuki-kimoto authored on 2009-11-16
104
    return unless $row;
added check_filter attribute
yuki-kimoto authored on 2010-08-08
105

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

            
cleanup
yuki-kimoto authored on 2010-10-17
136
sub fetch_hash_all {
137
    my $self = shift;
138
    
139
    # Fetch all rows as hash
140
    my $rows = [];
cleanup
Yuki Kimoto authored on 2011-06-15
141
    while(my $row = $self->fetch_hash) { push @$rows, $row }
cleanup
yuki-kimoto authored on 2010-10-17
142
    
143
    return $rows;
144
}
145

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
146
sub fetch_hash_first {
packaging one directory
yuki-kimoto authored on 2009-11-16
147
    my $self = shift;
148
    
149
    # Fetch hash
150
    my $row = $self->fetch_hash;
151
    return unless $row;
152
    
153
    # Finish statement handle
some changed
yuki-kimoto authored on 2010-05-02
154
    $self->sth->finish;
packaging one directory
yuki-kimoto authored on 2009-11-16
155
    
removed reconnect method
yuki-kimoto authored on 2010-05-28
156
    return $row;
packaging one directory
yuki-kimoto authored on 2009-11-16
157
}
158

            
renamed fetch_rows to fetch_...
yuki-kimoto authored on 2010-05-01
159
sub fetch_hash_multi {
packaging one directory
yuki-kimoto authored on 2009-11-16
160
    my ($self, $count) = @_;
161
    
cleanup
Yuki Kimoto authored on 2011-06-15
162
    # Fetch multiple rows
cleanup
Yuki Kimoto authored on 2011-04-25
163
    croak 'Row count must be specified ' . _subname
packaging one directory
yuki-kimoto authored on 2009-11-16
164
      unless $count;
165
    my $rows = [];
166
    for (my $i = 0; $i < $count; $i++) {
removed reconnect method
yuki-kimoto authored on 2010-05-28
167
        my $row = $self->fetch_hash;
168
        last unless $row;
169
        push @$rows, $row;
packaging one directory
yuki-kimoto authored on 2009-11-16
170
    }
171
    
172
    return unless @$rows;
removed reconnect method
yuki-kimoto authored on 2010-05-28
173
    return $rows;
packaging one directory
yuki-kimoto authored on 2009-11-16
174
}
175

            
cleanup
yuki-kimoto authored on 2010-10-17
176
sub fetch_multi {
177
    my ($self, $count) = @_;
packaging one directory
yuki-kimoto authored on 2009-11-16
178
    
cleanup
yuki-kimoto authored on 2010-10-17
179
    # Row count not specifed
cleanup
Yuki Kimoto authored on 2011-04-25
180
    croak 'Row count must be specified ' . _subname
cleanup
yuki-kimoto authored on 2010-10-17
181
      unless $count;
182
    
183
    # Fetch multi rows
packaging one directory
yuki-kimoto authored on 2009-11-16
184
    my $rows = [];
cleanup
yuki-kimoto authored on 2010-10-17
185
    for (my $i = 0; $i < $count; $i++) {
186
        my $row = $self->fetch;
187
        last unless $row;
removed reconnect method
yuki-kimoto authored on 2010-05-28
188
        push @$rows, $row;
packaging one directory
yuki-kimoto authored on 2009-11-16
189
    }
changed argument of tag proc...
yuki-kimoto authored on 2010-08-03
190
    
cleanup
yuki-kimoto authored on 2010-10-17
191
    return unless @$rows;
removed reconnect method
yuki-kimoto authored on 2010-05-28
192
    return $rows;
packaging one directory
yuki-kimoto authored on 2009-11-16
193
}
194

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

            
added EXPERIMENTAL DBIx::Cus...
Yuki Kimoto authored on 2011-06-14
197
sub type_rule {
198
    my $self = shift;
199
    
200
    # Merge type rule
201
    if (@_) {
202
        my $type_rule = @_ == 1 ? $_[0] : [@_];
203
        $type_rule = _array_to_hash($type_rule) || {};
204
        foreach my $data_type (keys %{$type_rule || {}}) {
205
            croak qq{data type of into section must be lower case or number}
206
              if $data_type =~ /[A-Z]/;
207
            my $fname = $type_rule->{$data_type};
208
            if (defined $fname && ref $fname ne 'CODE') {
209
                croak qq{Filter "$fname" is not registered" } . _subname
210
                  unless exists $self->filters->{$fname};
211
                
212
                $type_rule->{$data_type} = $self->filters->{$fname};
213
            }
214
        }
cleanup
Yuki Kimoto authored on 2011-06-15
215
        
216
        # Replace
217
        if (@_ == 1) { $self->{type_rule} = $type_rule }
218
        # Merge
219
        else { $self->{type_rule} = {%{$self->type_rule}, %$type_rule} }
DBIx::Custom::Result type_ru...
Yuki Kimoto authored on 2011-06-17
220
        
221
        return $self;
added EXPERIMENTAL DBIx::Cus...
Yuki Kimoto authored on 2011-06-14
222
    }
223
    
224
    return $self->{type_rule} ||= {};
225
}
226

            
cleanup
Yuki Kimoto authored on 2011-06-13
227
# DEPRECATED!
228
sub end_filter {
229
    my $self = shift;
230
    if (@_) {
231
        my $end_filter = {};
cleanup
Yuki Kimoto authored on 2011-06-15
232
        if (ref $_[0] eq 'HASH') { $end_filter = $_[0] }
233
        else { 
cleanup
Yuki Kimoto authored on 2011-06-13
234
            $end_filter = _array_to_hash(
235
                @_ > 1 ? [@_] : $_[0]
236
            );
237
        }
238
        foreach my $column (keys %$end_filter) {
239
            my $fname = $end_filter->{$column};
240
            if  (exists $end_filter->{$column}
241
              && defined $fname
242
              && ref $fname ne 'CODE') 
243
            {
244
              croak qq{Filter "$fname" is not registered" } . _subname
245
                unless exists $self->filters->{$fname};
246
              $end_filter->{$column} = $self->filters->{$fname};
247
            }
248
        }
249
        $self->{end_filter} = {%{$self->end_filter}, %$end_filter};
250
        return $self;
251
    }
252
    return $self->{end_filter} ||= {};
253
}
254

            
cleanup
Yuki Kimoto authored on 2011-06-13
255
# DEPRECATED!
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
256
sub remove_end_filter {
257
    my $self = shift;
cleanup
Yuki Kimoto authored on 2011-06-13
258
    warn "remove_end_filter is DEPRECATED! use filter_off attribute instead";
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
259
    $self->{end_filter} = {};
260
    return $self;
261
}
262

            
cleanup
Yuki Kimoto authored on 2011-06-13
263
# DEPRECATED!
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
264
sub remove_filter {
265
    my $self = shift;
cleanup
Yuki Kimoto authored on 2011-06-13
266
    warn "remove_filter is DEPRECATED! use filter_off attribute instead";
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
267
    $self->{filter} = {};
268
    return $self;
269
}
270

            
cleanup
Yuki Kimoto authored on 2011-06-13
271
# DEPRECATED!
cleanup
Yuki Kimoto authored on 2011-01-12
272
sub default_filter {
273
    my $self = shift;
cleanup
Yuki Kimoto authored on 2011-06-13
274
    warn "default_filter is DEPRECATED!";
cleanup
Yuki Kimoto authored on 2011-01-12
275
    if (@_) {
276
        my $fname = $_[0];
277
        if (@_ && !$fname) {
278
            $self->{default_filter} = undef;
279
        }
280
        else {
many changed
Yuki Kimoto authored on 2011-01-23
281
            croak qq{Filter "$fname" is not registered}
cleanup
Yuki Kimoto authored on 2011-01-12
282
              unless exists $self->filters->{$fname};
283
            $self->{default_filter} = $self->filters->{$fname};
284
        }
285
        return $self;
286
    }
287
    return $self->{default_filter};
288
}
289

            
cleanup
Yuki Kimoto authored on 2011-01-23
290
# DEPRECATED!
cleanup
Yuki Kimoto authored on 2011-06-13
291
has 'filter_check'; 
cleanup
Yuki Kimoto authored on 2011-01-23
292

            
update document
yuki-kimoto authored on 2010-01-30
293
1;
294

            
packaging one directory
yuki-kimoto authored on 2009-11-16
295
=head1 NAME
296

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

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

            
removed reconnect method
yuki-kimoto authored on 2010-05-28
301
    # Result
cleanup
Yuki Kimoto authored on 2011-06-15
302
    my $result = $dbi->select(table => 'book');
cleanup
yuki-kimoto authored on 2010-08-05
303

            
cleanup
Yuki Kimoto authored on 2011-06-15
304
    # Fetch a row and put it into array reference
removed reconnect method
yuki-kimoto authored on 2010-05-28
305
    while (my $row = $result->fetch) {
cleanup
yuki-kimoto authored on 2010-08-05
306
        my $author = $row->[0];
307
        my $title  = $row->[1];
version 0.0901
yuki-kimoto authored on 2009-12-17
308
    }
309
    
cleanup
Yuki Kimoto authored on 2011-06-15
310
    # Fetch only a first row and put it into array reference
removed reconnect method
yuki-kimoto authored on 2010-05-28
311
    my $row = $result->fetch_first;
312
    
cleanup
Yuki Kimoto authored on 2011-06-15
313
    # Fetch all rows and put them into array of array reference
removed reconnect method
yuki-kimoto authored on 2010-05-28
314
    my $rows = $result->fetch_all;
cleanup
yuki-kimoto authored on 2010-08-05
315

            
cleanup
Yuki Kimoto authored on 2011-06-15
316
    # Fetch a row and put it into hash reference
removed reconnect method
yuki-kimoto authored on 2010-05-28
317
    while (my $row = $result->fetch_hash) {
cleanup
yuki-kimoto authored on 2010-08-05
318
        my $title  = $row->{title};
319
        my $author = $row->{author};
packaging one directory
yuki-kimoto authored on 2009-11-16
320
    }
removed reconnect method
yuki-kimoto authored on 2010-05-28
321
    
cleanup
Yuki Kimoto authored on 2011-06-15
322
    # Fetch only a first row and put it into hash reference
removed reconnect method
yuki-kimoto authored on 2010-05-28
323
    my $row = $result->fetch_hash_first;
cleanup
Yuki Kimoto authored on 2011-06-15
324
    my $row = $result->one; # Same as fetch_hash_first
removed reconnect method
yuki-kimoto authored on 2010-05-28
325
    
cleanup
Yuki Kimoto authored on 2011-06-15
326
    # Fetch all rows and put them into array of hash reference
removed reconnect method
yuki-kimoto authored on 2010-05-28
327
    my $rows = $result->fetch_hash_all;
cleanup
Yuki Kimoto authored on 2011-06-15
328
    my $rows = $result->all; # Same as fetch_hash_all
packaging one directory
yuki-kimoto authored on 2009-11-16
329

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

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

            
334
    my $filter_off = $resutl->filter_off;
335
    $result = $result->filter_off(1);
336

            
cleanup
Yuki Kimoto authored on 2011-06-15
337
Filtering by C<filter> method is turned off.
updated_pod
Yuki Kimoto authored on 2011-06-12
338

            
cleanup
yuki-kimoto authored on 2010-10-17
339
=head2 C<filters>
340

            
341
    my $filters = $result->filters;
cleanup
Yuki Kimoto authored on 2011-06-15
342
    $result = $result->filters(\%filters);
cleanup
yuki-kimoto authored on 2010-10-17
343

            
cleanup
Yuki Kimoto authored on 2011-06-15
344
Filters.
cleanup
yuki-kimoto authored on 2010-10-17
345

            
346
=head2 C<sth>
347

            
348
    my $sth = $reuslt->sth
349
    $result = $result->sth($sth);
350

            
351
Statement handle of L<DBI>.
352

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

            
355
    my $type_rule_off = $result->type_rule_off;
356
    $result = $result->type_rule_off(1);
357

            
cleanup
Yuki Kimoto authored on 2011-06-15
358
Filtering by C<type_rule> is turned off.
added EXPERIMENTAL execute()...
Yuki Kimoto authored on 2011-06-09
359

            
update document
yuki-kimoto authored on 2010-01-30
360
=head1 METHODS
361

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

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

            
367
    my $rows = $result->all;
368

            
cleanup
Yuki Kimoto authored on 2011-06-15
369
Same as C<fetch_hash_all>.
updated pod
Yuki Kimoto authored on 2011-06-07
370

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

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

            
cleanup
Yuki Kimoto authored on 2011-06-15
375
Fetch a row and put it into array reference.
packaging one directory
yuki-kimoto authored on 2009-11-16
376

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

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

            
cleanup
Yuki Kimoto authored on 2011-06-15
381
Fetch all rows and put them into array of array reference.
packaging one directory
yuki-kimoto authored on 2009-11-16
382

            
cleanup
yuki-kimoto authored on 2010-10-17
383
=head2 C<fetch_first>
384

            
385
    my $row = $result->fetch_first;
386

            
cleanup
Yuki Kimoto authored on 2011-06-15
387
Fetch only a first row and put it into array reference,
388
and finish statment handle.
cleanup
yuki-kimoto authored on 2010-10-17
389

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

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

            
cleanup
Yuki Kimoto authored on 2011-06-15
394
Fetch a row and put it into hash reference.
update document
yuki-kimoto authored on 2009-11-19
395

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

            
398
    my $rows = $result->fetch_hash_all;
399

            
cleanup
Yuki Kimoto authored on 2011-06-15
400
Fetch all rows and put them into array of hash reference.
cleanup
yuki-kimoto authored on 2010-10-17
401

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

            
cleanup
Yuki Kimoto authored on 2011-06-15
406
Fetch only a first row and put it into hash reference,
407
and finish statment handle.
packaging one directory
yuki-kimoto authored on 2009-11-16
408

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

            
cleanup
yuki-kimoto authored on 2010-08-05
411
    my $rows = $result->fetch_hash_multi(5);
update document
yuki-kimoto authored on 2009-11-19
412
    
cleanup
Yuki Kimoto authored on 2011-06-15
413
Fetch multiple rows and put them into array of hash reference.
update document
yuki-kimoto authored on 2009-11-19
414

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

            
cleanup
yuki-kimoto authored on 2010-10-17
417
    my $rows = $result->fetch_multi(5);
418
    
cleanup
Yuki Kimoto authored on 2011-06-15
419
Fetch multiple rows and put them into array of array reference.
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
420

            
cleanup
Yuki Kimoto authored on 2010-12-21
421
=head2 C<filter>
422

            
cleanup
Yuki Kimoto authored on 2011-06-15
423
    $result->filter(title  => sub { uc $_[0] }, author => 'to_upper');
424
    $result->filter([qw/title author/] => 'to_upper');
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-17
425

            
cleanup
Yuki Kimoto authored on 2011-06-15
426
Set filter for column.
427
You can use subroutine or filter name as filter.
- DBIx::Custom Model filter ...
Yuki Kimoto authored on 2011-06-15
428
This filter is executed after C<type_rule> filter.
cleanup
Yuki Kimoto authored on 2010-12-21
429

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

            
432
    my $row = $result->one;
433

            
cleanup
Yuki Kimoto authored on 2011-06-15
434
Same as C<fetch_hash_first>.
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-02-28
435

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

            
438
    my $stash = $result->stash;
439
    my $foo = $result->stash->{foo};
440
    $result->stash->{foo} = $foo;
441

            
cleanup
Yuki Kimoto authored on 2011-06-15
442
Stash is hash reference for data.
added experimental DBIx::Cus...
Yuki Kimoto authored on 2011-01-25
443

            
added EXPERIMENTAL DBIx::Cus...
Yuki Kimoto authored on 2011-06-14
444
=head2 C<type_rule> EXPERIMENTAL
cleanup
Yuki Kimoto authored on 2011-06-15
445
    
446
    # Merge type rule
added EXPERIMENTAL DBIx::Cus...
Yuki Kimoto authored on 2011-06-14
447
    $result->type_rule(
448
        # DATE
449
        9 => sub { ... },
450
        # DATETIME or TIMESTAMP
451
        11 => sub { ... }
452
    );
453

            
cleanup
Yuki Kimoto authored on 2011-06-15
454
    # Replace type rule(by reference)
455
    $result->type_rule([
456
        # DATE
457
        9 => sub { ... },
458
        # DATETIME or TIMESTAMP
459
        11 => sub { ... }
460
    ]);
EXPERIMENTAL type_rule_off i...
Yuki Kimoto authored on 2011-06-14
461

            
cleanup
Yuki Kimoto authored on 2011-06-15
462
This is same as L<DBIx::Custom>'s C<type_rule>'s <from>.
EXPERIMENTAL type_rule_off i...
Yuki Kimoto authored on 2011-06-14
463

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