Newer Older
461 lines | 10.944kb
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} }
added EXPERIMENTAL DBIx::Cus...
Yuki Kimoto authored on 2011-06-14
220
    }
221
    
222
    return $self->{type_rule} ||= {};
223
}
224

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

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

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

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

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

            
update document
yuki-kimoto authored on 2010-01-30
291
1;
292

            
packaging one directory
yuki-kimoto authored on 2009-11-16
293
=head1 NAME
294

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

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

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

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

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

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

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

            
332
    my $filter_off = $resutl->filter_off;
333
    $result = $result->filter_off(1);
334

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

            
cleanup
yuki-kimoto authored on 2010-10-17
337
=head2 C<filters>
338

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

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

            
344
=head2 C<sth>
345

            
346
    my $sth = $reuslt->sth
347
    $result = $result->sth($sth);
348

            
349
Statement handle of L<DBI>.
350

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

            
353
    my $type_rule_off = $result->type_rule_off;
354
    $result = $result->type_rule_off(1);
355

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

            
update document
yuki-kimoto authored on 2010-01-30
358
=head1 METHODS
359

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

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

            
365
    my $rows = $result->all;
366

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

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

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

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

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

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

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

            
cleanup
yuki-kimoto authored on 2010-10-17
381
=head2 C<fetch_first>
382

            
383
    my $row = $result->fetch_first;
384

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

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

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

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

            
cleanup
yuki-kimoto authored on 2010-10-17
394
=head2 C<fetch_hash_all>
395

            
396
    my $rows = $result->fetch_hash_all;
397

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

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

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

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

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

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

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

            
cleanup
Yuki Kimoto authored on 2010-12-21
419
=head2 C<filter>
420

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

            
cleanup
Yuki Kimoto authored on 2011-06-15
424
Set filter for column.
425
You can use subroutine or filter name as filter.
cleanup
Yuki Kimoto authored on 2010-12-21
426

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

            
429
    my $row = $result->one;
430

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

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

            
435
    my $stash = $result->stash;
436
    my $foo = $result->stash->{foo};
437
    $result->stash->{foo} = $foo;
438

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

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

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

            
cleanup
Yuki Kimoto authored on 2011-06-15
459
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
460

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