packaging one directory
|
1 |
package DBIx::Custom::Result; |
updatedd pod
|
2 |
use Object::Simple -base; |
cleanup
|
3 | |
packaging one directory
|
4 |
use Carp 'croak'; |
cleanup
|
5 |
use DBIx::Custom::Util qw/_array_to_hash _subname/; |
packaging one directory
|
6 | |
sub module use DBIx::Custom ...
|
7 |
has [qw/dbi sth/], |
- changed EXPERIMENTAL DBIx:...
|
8 |
stash => sub { {} }; |
cleanup
|
9 | |
- added DBIx::Custom::Result...
|
10 |
*all = \&fetch_hash_all; |
11 | ||
cleanup
|
12 |
sub filter { |
13 |
my $self = shift; |
|
cleanup
|
14 |
|
cleanup
|
15 |
# Set |
cleanup
|
16 |
if (@_) { |
17 |
|
|
cleanup
|
18 |
# Convert filter name to subroutine |
19 |
my $filter = @_ == 1 ? $_[0] : [@_]; |
|
20 |
$filter = _array_to_hash($filter); |
|
cleanup
|
21 |
for my $column (keys %$filter) { |
cleanup
|
22 |
my $fname = $filter->{$column}; |
fix bug : filter can't over...
|
23 |
if (exists $filter->{$column} |
24 |
&& defined $fname |
|
25 |
&& ref $fname ne 'CODE') |
|
26 |
{ |
|
cleanup
|
27 |
croak qq{Filter "$fname" is not registered" } . _subname |
sub module use DBIx::Custom ...
|
28 |
unless exists $self->dbi->filters->{$fname}; |
29 |
$filter->{$column} = $self->dbi->filters->{$fname}; |
|
cleanup
|
30 |
} |
cleanup
|
31 |
} |
cleanup
|
32 |
|
cleanup
|
33 |
# Merge |
added experimental DBIx::Cus...
|
34 |
$self->{filter} = {%{$self->filter}, %$filter}; |
cleanup
|
35 |
|
36 |
return $self; |
|
cleanup
|
37 |
} |
38 |
|
|
added experimental DBIx::Cus...
|
39 |
return $self->{filter} ||= {}; |
40 |
} |
|
41 | ||
packaging one directory
|
42 |
sub fetch { |
changed argument of tag proc...
|
43 |
my $self = shift; |
44 |
|
|
added EXPERIMENTAL DBIx::Cus...
|
45 |
# Info |
46 |
my $columns = $self->{sth}->{NAME}; |
|
47 |
my $types = $self->{sth}->{TYPE}; |
|
48 |
|
|
packaging one directory
|
49 |
# Fetch |
changed argument of tag proc...
|
50 |
my @row = $self->{sth}->fetchrow_array; |
update document
|
51 |
return unless @row; |
added check_filter attribute
|
52 |
|
cleanup
|
53 |
# Filtering |
EXPERIMENTAL type_rule argum...
|
54 |
my $type_rule1 = $self->type_rule->{from1} || {}; |
55 |
my $type_rule2 = $self->type_rule->{from2} || {}; |
|
separate DBIx::Custom::Resul...
|
56 |
my $filter = $self->filter; |
fixed end_filter DEPRECATED ...
|
57 |
my $end_filter = $self->{end_filter} || {}; |
cleanup
|
58 |
for (my $i = 0; $i < @$columns; $i++) { |
added type_rule method and f...
|
59 |
|
separate DBIx::Custom::Resul...
|
60 |
# Column |
cleanup
|
61 |
my $column = $columns->[$i]; |
some changed
|
62 |
|
separate DBIx::Custom::Resul...
|
63 |
# Type rule |
EXPERIMENTAL type_rule argum...
|
64 |
my $type_filter1 = $type_rule1->{lc($types->[$i])}; |
65 |
$row[$i] = $type_filter1->($row[$i]) |
|
66 |
if $type_filter1 && !$self->{type_rule_off} |
|
67 |
&& !$self->{type_rule1_off}; |
|
68 |
my $type_filter2 = $type_rule2->{lc($types->[$i])}; |
|
69 |
$row[$i] = $type_filter2->($row[$i]) |
|
70 |
if $type_filter2 && !$self->{type_rule_off} |
|
71 |
&& !$self->{type_rule2_off}; |
|
separate DBIx::Custom::Resul...
|
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
|
79 |
} |
many many changes
|
80 | |
removed reconnect method
|
81 |
return \@row; |
82 |
} |
|
83 | ||
cleanup
|
84 |
sub fetch_all { |
85 |
my $self = shift; |
|
86 |
|
|
87 |
# Fetch all rows |
|
88 |
my $rows = []; |
|
cleanup
|
89 |
while(my $row = $self->fetch) { push @$rows, $row} |
90 |
|
|
cleanup
|
91 |
return $rows; |
92 |
} |
|
93 | ||
removed reconnect method
|
94 |
sub fetch_first { |
95 |
my $self = shift; |
|
96 |
|
|
97 |
# Fetch |
|
98 |
my $row = $self->fetch; |
|
99 |
return unless $row; |
|
100 |
|
|
101 |
# Finish statement handle |
|
102 |
$self->sth->finish; |
|
103 |
|
|
104 |
return $row; |
|
105 |
} |
|
106 | ||
packaging one directory
|
107 |
sub fetch_hash { |
changed argument of tag proc...
|
108 |
my $self = shift; |
109 |
|
|
added EXPERIMENTAL DBIx::Cus...
|
110 |
# Info |
111 |
my $columns = $self->{sth}->{NAME}; |
|
112 |
my $types = $self->{sth}->{TYPE}; |
|
113 |
|
|
packaging one directory
|
114 |
# Fetch |
changed argument of tag proc...
|
115 |
my $row = $self->{sth}->fetchrow_arrayref; |
packaging one directory
|
116 |
return unless $row; |
added check_filter attribute
|
117 | |
packaging one directory
|
118 |
# Filter |
separate DBIx::Custom::Resul...
|
119 |
my $hash_row = {}; |
120 |
my $filter = $self->filter; |
|
fixed end_filter DEPRECATED ...
|
121 |
my $end_filter = $self->{end_filter} || {}; |
EXPERIMENTAL type_rule argum...
|
122 |
my $type_rule1 = $self->type_rule->{from1} || {}; |
123 |
my $type_rule2 = $self->type_rule->{from2} || {}; |
|
cleanup
|
124 |
for (my $i = 0; $i < @$columns; $i++) { |
update document
|
125 |
|
separate DBIx::Custom::Resul...
|
126 |
# Column |
cleanup
|
127 |
my $column = $columns->[$i]; |
EXPERIMENTAL type_rule argum...
|
128 |
$hash_row->{$column} = $row->[$i]; |
add query filter error check
|
129 |
|
separate DBIx::Custom::Resul...
|
130 |
# Type rule |
EXPERIMENTAL type_rule argum...
|
131 |
my $type_filter1 = $type_rule1->{lc($types->[$i])}; |
132 |
$hash_row->{$column} = $type_filter1->($hash_row->{$column}) |
|
133 |
if !$self->{type_rule_off} && !$self->{type_rule1_off} |
|
134 |
&& $type_filter1; |
|
135 |
my $type_filter2 = $type_rule2->{lc($types->[$i])}; |
|
136 |
$hash_row->{$column} = $type_filter2->($hash_row->{$column}) |
|
137 |
if !$self->{type_rule_off} && !$self->{type_rule2_off} |
|
138 |
&& $type_filter2; |
|
separate DBIx::Custom::Resul...
|
139 |
|
140 |
# Filter |
|
141 |
my $f = $filter->{$column} || $self->{default_filter}; |
|
142 |
$hash_row->{$column} = $f->($hash_row->{$column}) |
|
143 |
if $f && !$self->{filter_off}; |
|
144 |
$hash_row->{$column} = $end_filter->{$column}->($hash_row->{$column}) |
|
145 |
if $end_filter->{$column} && !$self->{filter_off}; |
|
packaging one directory
|
146 |
} |
147 |
|
|
separate DBIx::Custom::Resul...
|
148 |
return $hash_row; |
packaging one directory
|
149 |
} |
150 | ||
cleanup
|
151 |
sub fetch_hash_all { |
152 |
my $self = shift; |
|
153 |
|
|
154 |
# Fetch all rows as hash |
|
155 |
my $rows = []; |
|
cleanup
|
156 |
while(my $row = $self->fetch_hash) { push @$rows, $row } |
cleanup
|
157 |
|
158 |
return $rows; |
|
159 |
} |
|
160 | ||
removed reconnect method
|
161 |
sub fetch_hash_first { |
packaging one directory
|
162 |
my $self = shift; |
163 |
|
|
164 |
# Fetch hash |
|
165 |
my $row = $self->fetch_hash; |
|
166 |
return unless $row; |
|
167 |
|
|
168 |
# Finish statement handle |
|
some changed
|
169 |
$self->sth->finish; |
packaging one directory
|
170 |
|
removed reconnect method
|
171 |
return $row; |
packaging one directory
|
172 |
} |
173 | ||
renamed fetch_rows to fetch_...
|
174 |
sub fetch_hash_multi { |
packaging one directory
|
175 |
my ($self, $count) = @_; |
176 |
|
|
cleanup
|
177 |
# Fetch multiple rows |
cleanup
|
178 |
croak 'Row count must be specified ' . _subname |
packaging one directory
|
179 |
unless $count; |
180 |
my $rows = []; |
|
181 |
for (my $i = 0; $i < $count; $i++) { |
|
removed reconnect method
|
182 |
my $row = $self->fetch_hash; |
183 |
last unless $row; |
|
184 |
push @$rows, $row; |
|
packaging one directory
|
185 |
} |
186 |
|
|
187 |
return unless @$rows; |
|
removed reconnect method
|
188 |
return $rows; |
packaging one directory
|
189 |
} |
190 | ||
cleanup
|
191 |
sub fetch_multi { |
192 |
my ($self, $count) = @_; |
|
packaging one directory
|
193 |
|
cleanup
|
194 |
# Row count not specifed |
cleanup
|
195 |
croak 'Row count must be specified ' . _subname |
cleanup
|
196 |
unless $count; |
197 |
|
|
198 |
# Fetch multi rows |
|
packaging one directory
|
199 |
my $rows = []; |
cleanup
|
200 |
for (my $i = 0; $i < $count; $i++) { |
201 |
my $row = $self->fetch; |
|
202 |
last unless $row; |
|
removed reconnect method
|
203 |
push @$rows, $row; |
packaging one directory
|
204 |
} |
changed argument of tag proc...
|
205 |
|
cleanup
|
206 |
return unless @$rows; |
removed reconnect method
|
207 |
return $rows; |
packaging one directory
|
208 |
} |
209 | ||
added EXPERIMENTAL DBIx::Cus...
|
210 |
sub header { shift->sth->{NAME} } |
211 | ||
- added DBIx::Custom::Result...
|
212 |
*one = \&fetch_hash_first; |
213 | ||
added EXPERIMENTAL DBIx::Cus...
|
214 |
sub type_rule { |
215 |
my $self = shift; |
|
216 |
|
|
217 |
if (@_) { |
|
EXPERIMENTAL type_rule argum...
|
218 |
my $type_rule = ref $_[0] eq 'HASH' ? $_[0] : {@_}; |
219 | ||
220 |
# From |
|
cleanup
|
221 |
for my $i (1 .. 2) { |
EXPERIMENTAL type_rule argum...
|
222 |
$type_rule->{"from$i"} = _array_to_hash($type_rule->{"from$i"}); |
cleanup
|
223 |
for my $data_type (keys %{$type_rule->{"from$i"} || {}}) { |
EXPERIMENTAL type_rule argum...
|
224 |
croak qq{data type of from$i section must be lower case or number} |
225 |
if $data_type =~ /[A-Z]/; |
|
226 |
my $fname = $type_rule->{"from$i"}{$data_type}; |
|
227 |
if (defined $fname && ref $fname ne 'CODE') { |
|
228 |
croak qq{Filter "$fname" is not registered" } . _subname |
|
sub module use DBIx::Custom ...
|
229 |
unless exists $self->dbi->filters->{$fname}; |
EXPERIMENTAL type_rule argum...
|
230 |
|
sub module use DBIx::Custom ...
|
231 |
$type_rule->{"from$i"}{$data_type} = $self->dbi->filters->{$fname}; |
EXPERIMENTAL type_rule argum...
|
232 |
} |
added EXPERIMENTAL DBIx::Cus...
|
233 |
} |
234 |
} |
|
EXPERIMENTAL type_rule argum...
|
235 |
$self->{type_rule} = $type_rule; |
DBIx::Custom::Result type_ru...
|
236 |
|
237 |
return $self; |
|
added EXPERIMENTAL DBIx::Cus...
|
238 |
} |
239 |
|
|
EXPERIMENTAL type_rule argum...
|
240 |
return $self->{type_rule} || {}; |
added EXPERIMENTAL DBIx::Cus...
|
241 |
} |
242 | ||
- changed EXPERIMENTAL DBIx:...
|
243 |
sub type_rule_off { |
244 |
my $self = shift; |
|
245 |
$self->{type_rule_off} = 1; |
|
246 |
return $self; |
|
247 |
} |
|
248 | ||
249 |
sub type_rule_on { |
|
250 |
my $self = shift; |
|
251 |
$self->{type_rule_off} = 0; |
|
252 |
return $self; |
|
253 |
} |
|
254 | ||
255 |
sub type_rule1_off { |
|
256 |
my $self = shift; |
|
257 |
$self->{type_rule1_off} = 1; |
|
258 |
return $self; |
|
259 |
} |
|
260 | ||
261 |
sub type_rule1_on { |
|
262 |
my $self = shift; |
|
263 |
$self->{type_rule1_off} = 0; |
|
264 |
return $self; |
|
265 |
} |
|
266 | ||
267 |
sub type_rule2_off { |
|
268 |
my $self = shift; |
|
269 |
$self->{type_rule2_off} = 1; |
|
270 |
return $self; |
|
271 |
} |
|
272 | ||
273 |
sub type_rule2_on { |
|
274 |
my $self = shift; |
|
275 |
$self->{type_rule2_off} = 0; |
|
276 |
return $self; |
|
277 |
} |
|
278 | ||
- DBIx::Custom::Result filte...
|
279 |
# DEPRECATED! |
280 |
sub filter_off { |
|
281 |
warn "filter_off method is DEPRECATED!"; |
|
282 |
my $self = shift; |
|
283 |
$self->{filter_off} = 1; |
|
284 |
return $self; |
|
285 |
} |
|
286 | ||
287 |
# DEPRECATED! |
|
288 |
sub filter_on { |
|
289 |
warn "filter_on method is DEPRECATED!"; |
|
290 |
my $self = shift; |
|
291 |
$self->{filter_off} = 0; |
|
292 |
return $self; |
|
293 |
} |
|
294 | ||
cleanup
|
295 |
# DEPRECATED! |
296 |
sub end_filter { |
|
- added EXPERIMENTAL order m...
|
297 |
warn "end_filter method is DEPRECATED!"; |
cleanup
|
298 |
my $self = shift; |
299 |
if (@_) { |
|
300 |
my $end_filter = {}; |
|
cleanup
|
301 |
if (ref $_[0] eq 'HASH') { $end_filter = $_[0] } |
302 |
else { |
|
cleanup
|
303 |
$end_filter = _array_to_hash( |
304 |
@_ > 1 ? [@_] : $_[0] |
|
305 |
); |
|
306 |
} |
|
cleanup
|
307 |
for my $column (keys %$end_filter) { |
cleanup
|
308 |
my $fname = $end_filter->{$column}; |
309 |
if (exists $end_filter->{$column} |
|
310 |
&& defined $fname |
|
311 |
&& ref $fname ne 'CODE') |
|
312 |
{ |
|
313 |
croak qq{Filter "$fname" is not registered" } . _subname |
|
sub module use DBIx::Custom ...
|
314 |
unless exists $self->dbi->filters->{$fname}; |
315 |
$end_filter->{$column} = $self->dbi->filters->{$fname}; |
|
cleanup
|
316 |
} |
317 |
} |
|
318 |
$self->{end_filter} = {%{$self->end_filter}, %$end_filter}; |
|
319 |
return $self; |
|
320 |
} |
|
321 |
return $self->{end_filter} ||= {}; |
|
322 |
} |
|
cleanup
|
323 |
# DEPRECATED! |
added experimental DBIx::Cus...
|
324 |
sub remove_end_filter { |
- added EXPERIMENTAL order m...
|
325 |
warn "remove_end_filter is DEPRECATED!"; |
added experimental DBIx::Cus...
|
326 |
my $self = shift; |
327 |
$self->{end_filter} = {}; |
|
328 |
return $self; |
|
329 |
} |
|
cleanup
|
330 |
# DEPRECATED! |
added experimental DBIx::Cus...
|
331 |
sub remove_filter { |
- added EXPERIMENTAL order m...
|
332 |
warn "remove_filter is DEPRECATED!"; |
added experimental DBIx::Cus...
|
333 |
my $self = shift; |
334 |
$self->{filter} = {}; |
|
335 |
return $self; |
|
336 |
} |
|
cleanup
|
337 |
# DEPRECATED! |
cleanup
|
338 |
sub default_filter { |
cleanup
|
339 |
warn "default_filter is DEPRECATED!"; |
- added EXPERIMENTAL order m...
|
340 |
my $self = shift; |
cleanup
|
341 |
if (@_) { |
342 |
my $fname = $_[0]; |
|
343 |
if (@_ && !$fname) { |
|
344 |
$self->{default_filter} = undef; |
|
345 |
} |
|
346 |
else { |
|
many changed
|
347 |
croak qq{Filter "$fname" is not registered} |
sub module use DBIx::Custom ...
|
348 |
unless exists $self->dbi->filters->{$fname}; |
349 |
$self->{default_filter} = $self->dbi->filters->{$fname}; |
|
cleanup
|
350 |
} |
351 |
return $self; |
|
352 |
} |
|
353 |
return $self->{default_filter}; |
|
354 |
} |
|
cleanup
|
355 |
# DEPRECATED! |
cleanup
|
356 |
has 'filter_check'; |
cleanup
|
357 | |
update document
|
358 |
1; |
359 | ||
packaging one directory
|
360 |
=head1 NAME |
361 | ||
cleanup
|
362 |
DBIx::Custom::Result - Result of select statement |
packaging one directory
|
363 | |
update document
|
364 |
=head1 SYNOPSIS |
cleanup
|
365 | |
removed reconnect method
|
366 |
# Result |
cleanup
|
367 |
my $result = $dbi->select(table => 'book'); |
cleanup
|
368 | |
cleanup
|
369 |
# Fetch a row and put it into array reference |
removed reconnect method
|
370 |
while (my $row = $result->fetch) { |
cleanup
|
371 |
my $author = $row->[0]; |
372 |
my $title = $row->[1]; |
|
version 0.0901
|
373 |
} |
374 |
|
|
cleanup
|
375 |
# Fetch only a first row and put it into array reference |
removed reconnect method
|
376 |
my $row = $result->fetch_first; |
377 |
|
|
cleanup
|
378 |
# Fetch all rows and put them into array of array reference |
removed reconnect method
|
379 |
my $rows = $result->fetch_all; |
cleanup
|
380 | |
cleanup
|
381 |
# Fetch a row and put it into hash reference |
removed reconnect method
|
382 |
while (my $row = $result->fetch_hash) { |
cleanup
|
383 |
my $title = $row->{title}; |
384 |
my $author = $row->{author}; |
|
packaging one directory
|
385 |
} |
removed reconnect method
|
386 |
|
cleanup
|
387 |
# Fetch only a first row and put it into hash reference |
removed reconnect method
|
388 |
my $row = $result->fetch_hash_first; |
cleanup
|
389 |
my $row = $result->one; # Same as fetch_hash_first |
removed reconnect method
|
390 |
|
cleanup
|
391 |
# Fetch all rows and put them into array of hash reference |
removed reconnect method
|
392 |
my $rows = $result->fetch_hash_all; |
cleanup
|
393 |
my $rows = $result->all; # Same as fetch_hash_all |
packaging one directory
|
394 | |
update document
|
395 |
=head1 ATTRIBUTES |
packaging one directory
|
396 | |
sub module use DBIx::Custom ...
|
397 |
=head2 C<dbi> |
cleanup
|
398 | |
sub module use DBIx::Custom ...
|
399 |
my $dbi = $result->dbi; |
400 |
$result = $result->dbi($dbi); |
|
cleanup
|
401 | |
sub module use DBIx::Custom ...
|
402 |
L<DBIx::Custom> object. |
cleanup
|
403 | |
404 |
=head2 C<sth> |
|
405 | ||
406 |
my $sth = $reuslt->sth |
|
407 |
$result = $result->sth($sth); |
|
408 | ||
409 |
Statement handle of L<DBI>. |
|
410 | ||
update document
|
411 |
=head1 METHODS |
412 | ||
renamed build_query to creat...
|
413 |
L<DBIx::Custom::Result> inherits all methods from L<Object::Simple> |
cleanup
|
414 |
and implements the following new ones. |
packaging one directory
|
415 | |
updated pod
|
416 |
=head2 C<all> |
417 | ||
418 |
my $rows = $result->all; |
|
419 | ||
cleanup
|
420 |
Same as C<fetch_hash_all>. |
updated pod
|
421 | |
removed DBIx::Custom commit ...
|
422 |
=head2 C<fetch> |
packaging one directory
|
423 | |
cleanup
|
424 |
my $row = $result->fetch; |
version 0.0901
|
425 | |
cleanup
|
426 |
Fetch a row and put it into array reference. |
packaging one directory
|
427 | |
removed DBIx::Custom commit ...
|
428 |
=head2 C<fetch_all> |
packaging one directory
|
429 | |
cleanup
|
430 |
my $rows = $result->fetch_all; |
version 0.0901
|
431 | |
cleanup
|
432 |
Fetch all rows and put them into array of array reference. |
packaging one directory
|
433 | |
cleanup
|
434 |
=head2 C<fetch_first> |
435 | ||
436 |
my $row = $result->fetch_first; |
|
437 | ||
cleanup
|
438 |
Fetch only a first row and put it into array reference, |
439 |
and finish statment handle. |
|
cleanup
|
440 | |
removed DESTROY method(not b...
|
441 |
=head2 C<fetch_hash> |
packaging one directory
|
442 | |
cleanup
|
443 |
my $row = $result->fetch_hash; |
packaging one directory
|
444 | |
cleanup
|
445 |
Fetch a row and put it into hash reference. |
update document
|
446 | |
cleanup
|
447 |
=head2 C<fetch_hash_all> |
448 | ||
449 |
my $rows = $result->fetch_hash_all; |
|
450 | ||
cleanup
|
451 |
Fetch all rows and put them into array of hash reference. |
cleanup
|
452 | |
removed DBIx::Custom commit ...
|
453 |
=head2 C<fetch_hash_first> |
removed reconnect method
|
454 |
|
cleanup
|
455 |
my $row = $result->fetch_hash_first; |
packaging one directory
|
456 | |
cleanup
|
457 |
Fetch only a first row and put it into hash reference, |
458 |
and finish statment handle. |
|
packaging one directory
|
459 | |
removed DESTROY method(not b...
|
460 |
=head2 C<fetch_hash_multi> |
update document
|
461 | |
cleanup
|
462 |
my $rows = $result->fetch_hash_multi(5); |
update document
|
463 |
|
cleanup
|
464 |
Fetch multiple rows and put them into array of hash reference. |
update document
|
465 | |
cleanup
|
466 |
=head2 C<fetch_multi> |
packaging one directory
|
467 | |
cleanup
|
468 |
my $rows = $result->fetch_multi(5); |
469 |
|
|
cleanup
|
470 |
Fetch multiple rows and put them into array of array reference. |
removed DESTROY method(not b...
|
471 | |
cleanup
|
472 |
=head2 C<filter> |
473 | ||
cleanup
|
474 |
$result->filter(title => sub { uc $_[0] }, author => 'to_upper'); |
475 |
$result->filter([qw/title author/] => 'to_upper'); |
|
added experimental DBIx::Cus...
|
476 | |
cleanup
|
477 |
Set filter for column. |
478 |
You can use subroutine or filter name as filter. |
|
- DBIx::Custom Model filter ...
|
479 |
This filter is executed after C<type_rule> filter. |
cleanup
|
480 | |
- removed EXPERIMENTAL statu...
|
481 |
=head2 C<header> |
added EXPERIMENTAL DBIx::Cus...
|
482 | |
483 |
my $header = $result->header; |
|
484 | ||
485 |
Get header column names. |
|
486 | ||
updated pod
|
487 |
=head2 C<one> |
488 | ||
489 |
my $row = $result->one; |
|
490 | ||
cleanup
|
491 |
Same as C<fetch_hash_first>. |
added experimental DBIx::Cus...
|
492 | |
- removed DEPRECATED DBIx::C...
|
493 |
=head2 C<stash> |
added experimental DBIx::Cus...
|
494 | |
495 |
my $stash = $result->stash; |
|
496 |
my $foo = $result->stash->{foo}; |
|
497 |
$result->stash->{foo} = $foo; |
|
498 | ||
cleanup
|
499 |
Stash is hash reference for data. |
added experimental DBIx::Cus...
|
500 | |
- removed EXPERIMENTAL flag ...
|
501 |
=head2 C<type_rule> |
cleanup
|
502 |
|
503 |
# Merge type rule |
|
added EXPERIMENTAL DBIx::Cus...
|
504 |
$result->type_rule( |
505 |
# DATE |
|
506 |
9 => sub { ... }, |
|
507 |
# DATETIME or TIMESTAMP |
|
508 |
11 => sub { ... } |
|
509 |
); |
|
510 | ||
cleanup
|
511 |
# Replace type rule(by reference) |
512 |
$result->type_rule([ |
|
513 |
# DATE |
|
514 |
9 => sub { ... }, |
|
515 |
# DATETIME or TIMESTAMP |
|
516 |
11 => sub { ... } |
|
517 |
]); |
|
EXPERIMENTAL type_rule_off i...
|
518 | |
cleanup
|
519 |
This is same as L<DBIx::Custom>'s C<type_rule>'s <from>. |
EXPERIMENTAL type_rule_off i...
|
520 | |
- removed EXPERIMENTAL flag ...
|
521 |
=head2 C<type_rule_off> |
- changed EXPERIMENTAL DBIx:...
|
522 | |
523 |
$result = $result->type_rule_off; |
|
524 | ||
525 |
Turn C<from1> and C<from2> type rule off. |
|
526 |
By default, type rule is on. |
|
527 | ||
- removed EXPERIMENTAL flag ...
|
528 |
=head2 C<type_rule_on> |
- changed EXPERIMENTAL DBIx:...
|
529 | |
530 |
$result = $result->type_rule_on; |
|
531 | ||
532 |
Turn C<from1> and C<from2> type rule on. |
|
533 |
By default, type rule is on. |
|
534 | ||
- removed EXPERIMENTAL flag ...
|
535 |
=head2 C<type_rule1_off> |
- changed EXPERIMENTAL DBIx:...
|
536 | |
537 |
$result = $result->type_rule1_off; |
|
538 | ||
539 |
Turn C<from1> type rule off. |
|
540 |
By default, type rule is on. |
|
541 | ||
- removed EXPERIMENTAL flag ...
|
542 |
=head2 C<type_rule1_on> |
- changed EXPERIMENTAL DBIx:...
|
543 | |
544 |
$result = $result->type_rule1_on; |
|
545 | ||
546 |
Turn C<from1> type rule on. |
|
547 |
By default, type rule is on. |
|
548 | ||
- removed EXPERIMENTAL flag ...
|
549 |
=head2 C<type_rule2_off> |
- changed EXPERIMENTAL DBIx:...
|
550 | |
551 |
$result = $result->type_rule2_off; |
|
552 | ||
553 |
Turn C<from2> type rule off. |
|
554 |
By default, type rule is on. |
|
555 | ||
- removed EXPERIMENTAL flag ...
|
556 |
=head2 C<type_rule2_on> |
- changed EXPERIMENTAL DBIx:...
|
557 | |
558 |
$result = $result->type_rule2_on; |
|
559 | ||
560 |
Turn C<from2> type rule on. |
|
561 |
By default, type rule is on. |
|
562 | ||
packaging one directory
|
563 |
=cut |