| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# DESCRIPTION |
|
3
|
|
|
|
|
|
|
# PerlORM - Object relational mapper (ORM) for Perl. PerlORM is Perl |
|
4
|
|
|
|
|
|
|
# library that implements object-relational mapping. Its features are |
|
5
|
|
|
|
|
|
|
# much similar to those of Java's Hibernate library, but interface is |
|
6
|
|
|
|
|
|
|
# much different and easier to use. |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# AUTHOR |
|
9
|
|
|
|
|
|
|
# Alexey V. Akimov |
|
10
|
|
|
|
|
|
|
# |
|
11
|
|
|
|
|
|
|
# COPYRIGHT |
|
12
|
|
|
|
|
|
|
# Copyright (C) 2005-2006 Alexey V. Akimov |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or |
|
15
|
|
|
|
|
|
|
# modify it under the terms of the GNU Lesser General Public |
|
16
|
|
|
|
|
|
|
# License as published by the Free Software Foundation; either |
|
17
|
|
|
|
|
|
|
# version 2.1 of the License, or (at your option) any later version. |
|
18
|
|
|
|
|
|
|
# |
|
19
|
|
|
|
|
|
|
# This library is distributed in the hope that it will be useful, |
|
20
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
22
|
|
|
|
|
|
|
# Lesser General Public License for more details. |
|
23
|
|
|
|
|
|
|
# |
|
24
|
|
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public |
|
25
|
|
|
|
|
|
|
# License along with this library; if not, write to the Free Software |
|
26
|
|
|
|
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
27
|
|
|
|
|
|
|
# |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
package ORM::Error; |
|
30
|
|
|
|
|
|
|
|
|
31
|
6
|
|
|
6
|
|
30396
|
use Exception::Class; |
|
|
6
|
|
|
|
|
76597
|
|
|
|
6
|
|
|
|
|
41
|
|
|
32
|
6
|
|
|
6
|
|
235
|
use base 'Exception::Class::Base'; |
|
|
6
|
|
|
|
|
13
|
|
|
|
6
|
|
|
|
|
757
|
|
|
33
|
6
|
|
|
6
|
|
51
|
use overload 'fallback'=>1; |
|
|
6
|
|
|
|
|
13
|
|
|
|
6
|
|
|
|
|
49
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$VERSION=0.83; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
ORM::Error->Trace( 1 ); |
|
38
|
|
|
|
|
|
|
ORM::Error->RespectOverload( 1 ); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
## |
|
41
|
|
|
|
|
|
|
## CONSTRUCTORS |
|
42
|
|
|
|
|
|
|
## |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub new |
|
45
|
|
|
|
|
|
|
{ |
|
46
|
638
|
|
|
638
|
1
|
1772
|
my $class = shift; |
|
47
|
638
|
|
|
|
|
2112
|
my $self = $class->SUPER::new(); |
|
48
|
|
|
|
|
|
|
|
|
49
|
638
|
|
|
|
|
380270
|
return $self; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub new_fatal |
|
53
|
|
|
|
|
|
|
{ |
|
54
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
|
55
|
0
|
|
|
|
|
0
|
my $msg = shift; |
|
56
|
0
|
|
|
|
|
0
|
my $self = $class->new(); |
|
57
|
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
0
|
$self->add_fatal( $msg ); |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
0
|
return $self; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub new_warn |
|
64
|
|
|
|
|
|
|
{ |
|
65
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
|
66
|
0
|
|
|
|
|
0
|
my $msg = shift; |
|
67
|
0
|
|
|
|
|
0
|
my $self = $class->new(); |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
0
|
$self->add_warn( $msg ); |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
0
|
return $self; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
## |
|
75
|
|
|
|
|
|
|
## OBJECT METHODS |
|
76
|
|
|
|
|
|
|
## |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub add |
|
79
|
|
|
|
|
|
|
{ |
|
80
|
366
|
|
|
366
|
0
|
541
|
my $self = shift; |
|
81
|
366
|
|
|
|
|
867
|
my %arg = @_; |
|
82
|
|
|
|
|
|
|
|
|
83
|
366
|
100
|
|
|
|
951
|
if( ref $arg{error} ) |
|
84
|
|
|
|
|
|
|
{ |
|
85
|
365
|
|
|
|
|
479
|
for my $err ( @{$arg{error}->{list}} ) |
|
|
365
|
|
|
|
|
1837
|
|
|
86
|
|
|
|
|
|
|
{ |
|
87
|
2
|
|
33
|
|
|
25
|
my $type = $arg{conv}{$err->{type}} || $err->{type}; |
|
88
|
2
|
|
|
|
|
8
|
$self->{fatal} = ( $type eq 'fatal' ); |
|
89
|
2
|
|
|
|
|
3
|
push @{$self->{list}}, |
|
|
2
|
|
|
|
|
69
|
|
|
90
|
|
|
|
|
|
|
{ |
|
91
|
|
|
|
|
|
|
class => $err->{class}, |
|
92
|
|
|
|
|
|
|
sub => $err->{sub}, |
|
93
|
|
|
|
|
|
|
type => $type, |
|
94
|
|
|
|
|
|
|
comment => $err->{comment}, |
|
95
|
|
|
|
|
|
|
}; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
else |
|
99
|
|
|
|
|
|
|
{ |
|
100
|
1
|
|
|
|
|
2
|
my( $package, $filename, $line, $sub ) = caller 1; |
|
101
|
|
|
|
|
|
|
|
|
102
|
1
|
50
|
|
|
|
3
|
if( $package ) |
|
103
|
|
|
|
|
|
|
{ |
|
104
|
0
|
|
|
|
|
0
|
$sub =~ s/^${package}:://; |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
else |
|
107
|
|
|
|
|
|
|
{ |
|
108
|
1
|
|
|
|
|
2
|
$package = caller; |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
1
|
|
|
|
|
3
|
$self->{fatal} = ( $arg{type} eq 'fatal' ); |
|
112
|
|
|
|
|
|
|
|
|
113
|
1
|
|
50
|
|
|
1
|
push @{$self->{list}}, |
|
|
1
|
|
|
|
|
11
|
|
|
114
|
|
|
|
|
|
|
{ |
|
115
|
|
|
|
|
|
|
class => $package, |
|
116
|
|
|
|
|
|
|
sub => ( $sub || 'main' ), |
|
117
|
|
|
|
|
|
|
type => $arg{type}, |
|
118
|
|
|
|
|
|
|
comment => $arg{comment}, |
|
119
|
|
|
|
|
|
|
}; |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub add_fatal |
|
124
|
|
|
|
|
|
|
{ |
|
125
|
7
|
|
|
7
|
1
|
33
|
my $self = shift; |
|
126
|
|
|
|
|
|
|
|
|
127
|
7
|
|
|
|
|
29
|
my( $package, $filename, $line, $sub ) = caller 1; |
|
128
|
|
|
|
|
|
|
|
|
129
|
7
|
100
|
|
|
|
10874
|
if( $package ) |
|
130
|
|
|
|
|
|
|
{ |
|
131
|
5
|
|
|
|
|
124
|
$sub =~ s/^${package}:://; |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
else |
|
134
|
|
|
|
|
|
|
{ |
|
135
|
2
|
|
|
|
|
5
|
$package = caller; |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
7
|
|
|
|
|
23
|
$self->{fatal} = 1; |
|
139
|
|
|
|
|
|
|
|
|
140
|
7
|
|
100
|
|
|
11
|
push @{$self->{list}}, |
|
|
7
|
|
|
|
|
80
|
|
|
141
|
|
|
|
|
|
|
{ |
|
142
|
|
|
|
|
|
|
class => $package, |
|
143
|
|
|
|
|
|
|
sub => ( $sub || 'main' ), |
|
144
|
|
|
|
|
|
|
type => 'fatal', |
|
145
|
|
|
|
|
|
|
comment => $_[0], |
|
146
|
|
|
|
|
|
|
}; |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub add_warn |
|
150
|
|
|
|
|
|
|
{ |
|
151
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
152
|
|
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
0
|
my( $package, $filename, $line, $sub ) = caller 1; |
|
154
|
0
|
|
|
|
|
0
|
$sub =~ s/^${package}:://; |
|
155
|
0
|
0
|
|
|
|
0
|
$package = caller unless( $package ); |
|
156
|
|
|
|
|
|
|
|
|
157
|
0
|
|
0
|
|
|
0
|
push @{$self->{list}}, |
|
|
0
|
|
|
|
|
0
|
|
|
158
|
|
|
|
|
|
|
{ |
|
159
|
|
|
|
|
|
|
class => $package, |
|
160
|
|
|
|
|
|
|
sub => ( $sub || 'main' ), |
|
161
|
|
|
|
|
|
|
type => 'warning', |
|
162
|
|
|
|
|
|
|
comment => $_[0], |
|
163
|
|
|
|
|
|
|
}; |
|
164
|
|
|
|
|
|
|
} |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub upto |
|
167
|
|
|
|
|
|
|
{ |
|
168
|
218
|
|
|
218
|
1
|
342
|
my $self = shift; |
|
169
|
218
|
|
|
|
|
301
|
my $up = shift; |
|
170
|
|
|
|
|
|
|
|
|
171
|
218
|
100
|
|
|
|
841
|
if( UNIVERSAL::isa( $up, 'ORM::Error' ) ) |
|
|
|
50
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
{ |
|
173
|
194
|
|
|
|
|
648
|
$up->add( error=>$self ); |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
elsif( $self->fatal ) |
|
176
|
|
|
|
|
|
|
{ |
|
177
|
0
|
|
|
|
|
0
|
$self->throw; |
|
178
|
|
|
|
|
|
|
} |
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
## |
|
182
|
|
|
|
|
|
|
## OBJECT PROPERTIES |
|
183
|
|
|
|
|
|
|
## |
|
184
|
|
|
|
|
|
|
|
|
185
|
0
|
|
|
0
|
1
|
0
|
sub full_message { shift->short_text( @_ ); } |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub short_text |
|
188
|
|
|
|
|
|
|
{ |
|
189
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
190
|
0
|
|
|
|
|
0
|
my $text = ''; |
|
191
|
|
|
|
|
|
|
|
|
192
|
0
|
|
|
|
|
0
|
for( @{$self->{list}} ) |
|
|
0
|
|
|
|
|
0
|
|
|
193
|
|
|
|
|
|
|
{ |
|
194
|
0
|
|
|
|
|
0
|
$text .= "* $_->{comment}\n"; |
|
195
|
|
|
|
|
|
|
} |
|
196
|
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
0
|
return $text; |
|
198
|
|
|
|
|
|
|
} |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub short_html |
|
201
|
|
|
|
|
|
|
{ |
|
202
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
203
|
0
|
|
|
|
|
0
|
my $text = ' |
|
204
|
|
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
0
|
for( @{$self->{list}} ) |
|
|
0
|
|
|
|
|
0
|
|
|
206
|
|
|
|
|
|
|
{ |
|
207
|
0
|
|
|
|
|
0
|
$text .= " $_->{comment}\n"; |
|
208
|
|
|
|
|
|
|
} |
|
209
|
0
|
|
|
|
|
0
|
$text .= ''; |
|
210
|
|
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
0
|
return $text; |
|
212
|
|
|
|
|
|
|
} |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
sub text |
|
215
|
|
|
|
|
|
|
{ |
|
216
|
107
|
|
|
107
|
1
|
240
|
my $self = shift; |
|
217
|
107
|
|
|
|
|
206
|
my $text = ''; |
|
218
|
|
|
|
|
|
|
|
|
219
|
107
|
|
|
|
|
361
|
for( @{$self->{list}} ) |
|
|
107
|
|
|
|
|
505
|
|
|
220
|
|
|
|
|
|
|
{ |
|
221
|
8
|
|
|
|
|
53
|
$text .= sprintf "%s: %s->%s(): %s\n", |
|
222
|
|
|
|
|
|
|
$_->{type}, $_->{class}, $_->{sub}, $_->{comment}; |
|
223
|
|
|
|
|
|
|
} |
|
224
|
|
|
|
|
|
|
|
|
225
|
107
|
|
|
|
|
1986
|
return $text; |
|
226
|
|
|
|
|
|
|
} |
|
227
|
|
|
|
|
|
|
|
|
228
|
112
|
100
|
|
112
|
1
|
903
|
sub any { defined $_[0]->{list} && scalar @{$_[0]->{list}}; } |
|
|
1
|
|
|
|
|
5
|
|
|
229
|
695
|
|
|
695
|
1
|
12315
|
sub fatal { $_[0]->{fatal}; } |