line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::DataStore::ResultRow::impl; |
2
|
|
|
|
|
|
|
$DBIx::DataStore::ResultRow::impl::VERSION = '0.097'; |
3
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
53
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
82
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
*DEBUG = *DBIx::DataStore::DEBUG; |
7
|
|
|
|
|
|
|
*dslog = *DBIx::DataStore::dslog; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
6
|
use constant INDEX => 0; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
142
|
|
10
|
2
|
|
|
2
|
|
8
|
use constant KEYS => 1; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
94
|
|
11
|
2
|
|
|
2
|
|
8
|
use constant VALUES => 2; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
82
|
|
12
|
2
|
|
|
2
|
|
8
|
use constant ITER => 3; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
696
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub TIEHASH { |
15
|
19
|
|
|
19
|
|
136
|
bless [ $_[2], $_[1], $_[3], 0 ], $_[0]; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub FETCH { |
19
|
|
|
|
|
|
|
return exists $_[0]->[INDEX]->{$_[1]} |
20
|
5
|
50
|
|
5
|
|
49
|
? $_[0]->[VALUES]->[ $_[0]->[INDEX]->{$_[1]} ] |
21
|
|
|
|
|
|
|
: die dslog("Invalid column name specified: $_[1]"); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub STORE { |
25
|
|
|
|
|
|
|
exists $_[0]->[INDEX]->{$_[1]} |
26
|
0
|
0
|
|
0
|
|
0
|
? ($_[0]->[VALUES]->[ $_[0]->[INDEX]->{$_[1]} ] = $_[2]) |
27
|
|
|
|
|
|
|
: die dslog("Cannot store to invalid column name: $_[1]"); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub DELETE { |
31
|
0
|
|
|
0
|
|
0
|
die dslog("Cannot delete columns from result set rows!"); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub EXISTS { |
35
|
0
|
|
|
0
|
|
0
|
return exists $_[0]->[INDEX]->{$_[1]}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub FIRSTKEY { |
39
|
0
|
|
|
0
|
|
0
|
$_[0]->[ITER] = 0; |
40
|
0
|
|
|
|
|
0
|
NEXTKEY($_[0]); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub NEXTKEY { |
44
|
0
|
0
|
|
0
|
|
0
|
return $_[0]->[KEYS]->[ $_[0]->[ITER]++ ] if $_[0]->[ITER] < @{ $_[0]->[KEYS] }; |
|
0
|
|
|
|
|
0
|
|
45
|
0
|
|
|
|
|
0
|
return undef; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
package DBIx::DataStore::ResultRow; |
49
|
|
|
|
|
|
|
$DBIx::DataStore::ResultRow::VERSION = '0.097'; |
50
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
44
|
|
51
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
85
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
*DEBUG = *DBIx::DataStore::DEBUG; |
54
|
|
|
|
|
|
|
*dslog = *DBIx::DataStore::dslog; |
55
|
|
|
|
|
|
|
|
56
|
2
|
|
|
2
|
|
8
|
use constant INDEX => DBIx::DataStore::ResultRow::impl::INDEX; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
127
|
|
57
|
2
|
|
|
2
|
|
8
|
use constant KEYS => DBIx::DataStore::ResultRow::impl::KEYS; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
92
|
|
58
|
2
|
|
|
2
|
|
8
|
use constant VALUES => DBIx::DataStore::ResultRow::impl::VALUES; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
107
|
|
59
|
2
|
|
|
2
|
|
9
|
use constant ITER => DBIx::DataStore::ResultRow::impl::ITER; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
242
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
use overload ( |
62
|
5
|
|
|
5
|
|
6
|
'%{}' => sub { ${$_[0]}->{hash} }, |
|
5
|
|
|
|
|
29
|
|
63
|
4
|
|
|
4
|
|
9
|
'@{}' => sub { ${$_[0]}->{impl}->[VALUES] }, |
|
4
|
|
|
|
|
37
|
|
64
|
0
|
0
|
|
0
|
|
0
|
'""' => sub { 'ResultRow:' . (@{$_[0]} ? join('||', @{$_[0]}) : '') }, |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
65
|
2
|
|
|
2
|
|
1249
|
); |
|
2
|
|
|
|
|
889
|
|
|
2
|
|
|
|
|
21
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
our $AUTOLOAD; |
68
|
|
|
|
|
|
|
sub AUTOLOAD { |
69
|
0
|
|
|
0
|
|
0
|
my ($method) = $AUTOLOAD =~ /::(\w+)$/; |
70
|
0
|
0
|
|
|
|
0
|
return if $method eq 'DESTROY'; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
0
|
my ($self) = @_; |
73
|
|
|
|
|
|
|
|
74
|
0
|
0
|
0
|
|
|
0
|
if (ref($self) eq 'DBIx::DataStore::ResultRow' || ref($self) eq 'DBIx::DataStore::ResultSet') { |
75
|
|
|
|
|
|
|
return exists $$self->{hash}->{$method} |
76
|
0
|
0
|
|
|
|
0
|
? $$self->{hash}->{$method} |
77
|
|
|
|
|
|
|
: die dslog("No such method (or column): $method"); |
78
|
|
|
|
|
|
|
} else { |
79
|
0
|
|
|
|
|
0
|
die dslog("No such class method: $method"); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub new { |
84
|
19
|
|
|
19
|
0
|
44
|
my $self = \{}; |
85
|
19
|
|
|
|
|
29
|
my %tied_hash; |
86
|
19
|
|
|
|
|
131
|
$$self->{impl} = tie %tied_hash, $_[0] . '::impl', $_[1], $_[2], $_[3]; |
87
|
19
|
|
|
|
|
67
|
$$self->{hash} = \%tied_hash; |
88
|
|
|
|
|
|
|
|
89
|
19
|
|
|
|
|
82
|
return bless($self, $_[0]); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub col { |
93
|
0
|
|
|
0
|
0
|
0
|
my ($self, $id) = @_; |
94
|
|
|
|
|
|
|
|
95
|
0
|
0
|
|
|
|
0
|
return $id =~ /^\d+$/o ? $self->[$id] : $self->{$id}; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub columns { |
99
|
1
|
|
|
1
|
0
|
362
|
my ($self) = @_; |
100
|
|
|
|
|
|
|
|
101
|
1
|
|
|
|
|
2
|
return @{ $$self->{impl}->[KEYS] }; |
|
1
|
|
|
|
|
9
|
|
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub hashref { |
105
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
return { map { $_ => $$self->{hash}->{$_} } @{ $$self->{impl}->[KEYS] } }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub num_cols { |
111
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
return scalar @{ $$self->{impl}->[VALUES] }; |
|
0
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
1; |