line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::CDBICompat::Iterator; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
2348
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
48
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
137
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
DBIx::Class::CDBICompat::Iterator - Emulates the extra behaviors of the Class::DBI search iterator. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
See DBIx::Class::CDBICompat for usage directions. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Emulates the extra behaviors of the Class::DBI search iterator. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head2 Differences from DBIx::Class result set |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
The CDBI iterator returns true if there were any results, false otherwise. The DBIC result set always returns true. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _init_result_source_instance { |
27
|
0
|
|
|
0
|
|
|
my $class = shift; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $table = $class->next::method(@_); |
30
|
0
|
|
|
|
|
|
$table->resultset_class("DBIx::Class::CDBICompat::Iterator::ResultSet"); |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
return $table; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 FURTHER QUESTIONS? |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE> |
42
|
|
|
|
|
|
|
by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can |
43
|
|
|
|
|
|
|
redistribute it and/or modify it under the same terms as the |
44
|
|
|
|
|
|
|
L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
package # hide |
49
|
|
|
|
|
|
|
DBIx::Class::CDBICompat::Iterator::ResultSet; |
50
|
|
|
|
|
|
|
|
51
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
43
|
|
52
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
57
|
|
53
|
|
|
|
|
|
|
|
54
|
2
|
|
|
2
|
|
10
|
use base qw(DBIx::Class::ResultSet); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
440
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _bool { |
57
|
|
|
|
|
|
|
# Performance hack so internal checks whether the result set |
58
|
|
|
|
|
|
|
# exists won't do a SQL COUNT. |
59
|
0
|
0
|
|
0
|
|
|
return 1 if caller =~ /^DBIx::Class::/; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
return $_[0]->count; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _construct_results { |
65
|
0
|
|
|
0
|
|
|
my $self = shift; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
my $rows = $self->next::method(@_); |
68
|
|
|
|
|
|
|
|
69
|
0
|
0
|
|
|
|
|
if (my $f = $self->_resolved_attrs->{record_filter}) { |
70
|
0
|
|
|
|
|
|
$_ = $f->($_) for @$rows; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
return $rows; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |