| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Pg::SQL::PrettyPrinter::Node::ResTarget; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# UTF8 boilerplace, per http://stackoverflow.com/questions/6162484/why-does-modern-perl-avoid-utf-8-by-default/ |
|
4
|
11
|
|
|
11
|
|
13196
|
use v5.26; |
|
|
11
|
|
|
|
|
50
|
|
|
5
|
11
|
|
|
11
|
|
71
|
use strict; |
|
|
11
|
|
|
|
|
27
|
|
|
|
11
|
|
|
|
|
394
|
|
|
6
|
11
|
|
|
11
|
|
53
|
use warnings; |
|
|
11
|
|
|
|
|
20
|
|
|
|
11
|
|
|
|
|
1017
|
|
|
7
|
11
|
|
|
11
|
|
74
|
use warnings qw( FATAL utf8 ); |
|
|
11
|
|
|
|
|
22
|
|
|
|
11
|
|
|
|
|
712
|
|
|
8
|
11
|
|
|
11
|
|
97
|
use utf8; |
|
|
11
|
|
|
|
|
22
|
|
|
|
11
|
|
|
|
|
197
|
|
|
9
|
11
|
|
|
11
|
|
461
|
use open qw( :std :utf8 ); |
|
|
11
|
|
|
|
|
36
|
|
|
|
11
|
|
|
|
|
109
|
|
|
10
|
11
|
|
|
11
|
|
2068
|
use Unicode::Normalize qw( NFC ); |
|
|
11
|
|
|
|
|
30
|
|
|
|
11
|
|
|
|
|
929
|
|
|
11
|
11
|
|
|
11
|
|
74
|
use Unicode::Collate; |
|
|
11
|
|
|
|
|
24
|
|
|
|
11
|
|
|
|
|
1518
|
|
|
12
|
11
|
|
|
11
|
|
77
|
use Encode qw( decode ); |
|
|
11
|
|
|
|
|
29
|
|
|
|
11
|
|
|
|
|
2026
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
if ( grep /\P{ASCII}/ => @ARGV ) { |
|
15
|
|
|
|
|
|
|
@ARGV = map { decode( 'UTF-8', $_ ) } @ARGV; |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# If there is __DATA__,then uncomment next line: |
|
19
|
|
|
|
|
|
|
# binmode( DATA, ':encoding(UTF-8)' ); |
|
20
|
|
|
|
|
|
|
# UTF8 boilerplace, per http://stackoverflow.com/questions/6162484/why-does-modern-perl-avoid-utf-8-by-default/ |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Useful common code |
|
23
|
11
|
|
|
11
|
|
86
|
use autodie; |
|
|
11
|
|
|
|
|
27
|
|
|
|
11
|
|
|
|
|
108
|
|
|
24
|
11
|
|
|
11
|
|
75924
|
use Carp qw( carp croak confess cluck ); |
|
|
11
|
|
|
|
|
34
|
|
|
|
11
|
|
|
|
|
1318
|
|
|
25
|
11
|
|
|
11
|
|
88
|
use English qw( -no_match_vars ); |
|
|
11
|
|
|
|
|
41
|
|
|
|
11
|
|
|
|
|
108
|
|
|
26
|
11
|
|
|
11
|
|
7309
|
use Data::Dumper qw( Dumper ); |
|
|
11
|
|
|
|
|
27
|
|
|
|
11
|
|
|
|
|
3194
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# give a full stack dump on any untrapped exceptions |
|
29
|
|
|
|
|
|
|
local $SIG{ __DIE__ } = sub { |
|
30
|
|
|
|
|
|
|
confess "Uncaught exception: @_" unless $^S; |
|
31
|
|
|
|
|
|
|
}; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# now promote run-time warnings into stackdumped exceptions |
|
34
|
|
|
|
|
|
|
# *unless* we're in an try block, in which |
|
35
|
|
|
|
|
|
|
# case just generate a clucking stackdump instead |
|
36
|
|
|
|
|
|
|
local $SIG{ __WARN__ } = sub { |
|
37
|
|
|
|
|
|
|
if ( $^S ) { cluck "Trapped warning: @_" } |
|
38
|
|
|
|
|
|
|
else { confess "Deadly warning: @_" } |
|
39
|
|
|
|
|
|
|
}; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Useful common code |
|
42
|
|
|
|
|
|
|
|
|
43
|
11
|
|
|
11
|
|
91
|
use parent qw( Pg::SQL::PrettyPrinter::Node ); |
|
|
11
|
|
|
|
|
29
|
|
|
|
11
|
|
|
|
|
105
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new { |
|
46
|
326
|
|
|
326
|
1
|
10573
|
my $class = shift; |
|
47
|
326
|
|
|
|
|
1153
|
my $self = $class->SUPER::new( @_ ); |
|
48
|
326
|
|
|
|
|
744
|
bless $self, $class; |
|
49
|
|
|
|
|
|
|
|
|
50
|
326
|
|
|
|
|
1267
|
$self->objectify( 'val' ); |
|
51
|
326
|
|
|
|
|
749
|
return $self; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub as_text { |
|
55
|
345
|
|
|
345
|
1
|
572
|
my $self = shift; |
|
56
|
345
|
|
50
|
|
|
1247
|
my $mode = shift || 'select'; |
|
57
|
|
|
|
|
|
|
|
|
58
|
345
|
|
|
|
|
516
|
my $val; |
|
59
|
345
|
50
|
|
|
|
790
|
if ( $mode eq 'assignment' ) { |
|
60
|
0
|
|
|
|
|
0
|
$val = $self->quote_ident( $self->{ 'name' } ) . ' = ' . $self->{ 'val' }->as_text; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
else { |
|
63
|
345
|
100
|
|
|
|
802
|
if ( exists $self->{ 'val' } ) { |
|
64
|
265
|
|
|
|
|
869
|
$val = $self->{ 'val' }->as_text(); |
|
65
|
265
|
100
|
|
|
|
842
|
if ( exists( $self->{ 'name' } ) ) { |
|
66
|
18
|
|
|
|
|
76
|
$val .= ' AS ' . $self->quote_ident( $self->{ 'name' } ); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
else { |
|
70
|
80
|
|
|
|
|
222
|
$val = $self->quote_ident( $self->{ 'name' } ); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
} |
|
73
|
345
|
|
|
|
|
1289
|
return $val; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub pretty_print { |
|
77
|
248
|
|
|
248
|
1
|
370
|
my $self = shift; |
|
78
|
248
|
|
50
|
|
|
914
|
my $mode = shift || 'select'; |
|
79
|
|
|
|
|
|
|
|
|
80
|
248
|
|
|
|
|
412
|
my $val; |
|
81
|
248
|
50
|
|
|
|
506
|
if ( $mode eq 'assignment' ) { |
|
82
|
0
|
|
|
|
|
0
|
$val = $self->quote_ident( $self->{ 'name' } ) . ' = ' . $self->{ 'val' }->pretty_print; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
else { |
|
85
|
248
|
50
|
|
|
|
565
|
if ( exists $self->{ 'val' } ) { |
|
86
|
248
|
|
|
|
|
954
|
$val = $self->{ 'val' }->pretty_print(); |
|
87
|
248
|
100
|
|
|
|
4025
|
if ( exists( $self->{ 'name' } ) ) { |
|
88
|
18
|
|
|
|
|
57
|
$val .= ' AS ' . $self->quote_ident( $self->{ 'name' } ); |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
else { |
|
92
|
0
|
|
|
|
|
0
|
$val = $self->quote_ident( $self->{ 'name' } ); |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
} |
|
95
|
248
|
|
|
|
|
925
|
return $val; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |