line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pg::SQL::PrettyPrinter::Node::RangeVar; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# UTF8 boilerplace, per http://stackoverflow.com/questions/6162484/why-does-modern-perl-avoid-utf-8-by-default/ |
4
|
7
|
|
|
7
|
|
4397
|
use v5.26; |
|
7
|
|
|
|
|
28
|
|
5
|
7
|
|
|
7
|
|
39
|
use strict; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
149
|
|
6
|
7
|
|
|
7
|
|
36
|
use warnings; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
202
|
|
7
|
7
|
|
|
7
|
|
35
|
use warnings qw( FATAL utf8 ); |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
264
|
|
8
|
7
|
|
|
7
|
|
41
|
use utf8; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
60
|
|
9
|
7
|
|
|
7
|
|
214
|
use open qw( :std :utf8 ); |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
37
|
|
10
|
7
|
|
|
7
|
|
1005
|
use Unicode::Normalize qw( NFC ); |
|
7
|
|
|
|
|
25
|
|
|
7
|
|
|
|
|
471
|
|
11
|
7
|
|
|
7
|
|
71
|
use Unicode::Collate; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
235
|
|
12
|
7
|
|
|
7
|
|
57
|
use Encode qw( decode ); |
|
7
|
|
|
|
|
27
|
|
|
7
|
|
|
|
|
471
|
|
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
|
7
|
|
|
7
|
|
1511
|
use autodie; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
44
|
|
24
|
7
|
|
|
7
|
|
38275
|
use Carp qw( carp croak confess cluck ); |
|
7
|
|
|
|
|
23
|
|
|
7
|
|
|
|
|
557
|
|
25
|
7
|
|
|
7
|
|
47
|
use English qw( -no_match_vars ); |
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
54
|
|
26
|
7
|
|
|
7
|
|
2547
|
use Data::Dumper qw( Dumper ); |
|
7
|
|
|
|
|
73
|
|
|
7
|
|
|
|
|
1596
|
|
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
|
7
|
|
|
7
|
|
91
|
use parent qw( Pg::SQL::PrettyPrinter::Node ); |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
46
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new { |
46
|
72
|
|
|
72
|
1
|
2282
|
my $class = shift; |
47
|
72
|
|
|
|
|
268
|
my $self = $class->SUPER::new( @_ ); |
48
|
72
|
|
|
|
|
173
|
bless $self, $class; |
49
|
|
|
|
|
|
|
|
50
|
72
|
|
|
|
|
357
|
$self->objectify( [ 'alias', 'colnames' ] ); |
51
|
|
|
|
|
|
|
|
52
|
72
|
|
|
|
|
207
|
return $self; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub as_text { |
56
|
142
|
|
|
142
|
1
|
237
|
my $self = shift; |
57
|
142
|
|
|
|
|
431
|
my @elements = map { $self->quote_ident( $self->{ $_ } ) } |
58
|
142
|
|
|
|
|
283
|
grep { exists $self->{ $_ } } qw{ catalogname schemaname relname }; |
|
426
|
|
|
|
|
957
|
|
59
|
142
|
|
|
|
|
349
|
my $full_name = join( '.', @elements ); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Shortcut |
62
|
142
|
|
|
|
|
272
|
my $A = $self->{ 'alias' }; |
63
|
142
|
100
|
|
|
|
576
|
return $full_name unless $A; |
64
|
|
|
|
|
|
|
|
65
|
24
|
|
|
|
|
73
|
my $base_with_alias = sprintf( '%s AS %s', $full_name, $self->quote_ident( $A->{ 'aliasname' } ) ); |
66
|
24
|
50
|
|
|
|
136
|
return $base_with_alias unless $A->{ 'colnames' }; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return sprintf( '%s ( %s )', $base_with_alias, join( ', ', map { $_->as_ident } @{ $A->{ 'colnames' } } ) ); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |