line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Protocol::Database::PostgreSQL::Backend::ErrorResponse; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '2.000'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use parent qw(Protocol::Database::PostgreSQL::Backend); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Protocol::Database::PostgreSQL::Backend::ErrorResponse |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
409
|
use Protocol::Database::PostgreSQL::Error; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
19
|
1
|
|
|
1
|
|
5
|
use Log::Any qw($log); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
0
|
0
|
|
sub type { 'error_response' } |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
0
|
0
|
|
sub error { shift->{error} } |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new_from_message { |
26
|
0
|
|
|
0
|
1
|
|
my ($class, $msg) = @_; |
27
|
0
|
|
|
|
|
|
(undef, my $size) = unpack('C1N1', $msg); |
28
|
0
|
|
|
|
|
|
substr $msg, 0, 5, ''; |
29
|
0
|
|
|
|
|
|
my %notice; |
30
|
|
|
|
|
|
|
FIELD: |
31
|
0
|
|
|
|
|
|
while(length($msg)) { |
32
|
0
|
|
|
|
|
|
my ($code, $str) = unpack('A1Z*', $msg); |
33
|
0
|
0
|
0
|
|
|
|
last FIELD unless $code && $code ne "\0"; |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
die "Unknown NOTICE code [$code]" unless exists $Protocol::Database::PostgreSQL::NOTICE_CODE{$code}; |
36
|
0
|
|
|
|
|
|
$notice{$Protocol::Database::PostgreSQL::NOTICE_CODE{$code}} = $str; |
37
|
0
|
|
|
|
|
|
substr $msg, 0, 2+length($str), ''; |
38
|
|
|
|
|
|
|
} |
39
|
0
|
|
|
|
|
|
$log->tracef("Error was %s", \%notice); |
40
|
0
|
|
|
|
|
|
return $class->new( |
41
|
|
|
|
|
|
|
error => Protocol::Database::PostgreSQL::Error->new(%notice) |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 AUTHOR |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Tom Molesworth |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 LICENSE |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Copyright Tom Molesworth 2010-2019. Licensed under the same terms as Perl itself. |
54
|
|
|
|
|
|
|
|