line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SQL::Tree; |
2
|
1
|
|
|
1
|
|
408
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
6
|
use File::Basename; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
153
|
|
5
|
1
|
|
|
1
|
|
507
|
use File::ShareDir::Dist 'dist_share'; |
|
1
|
|
|
|
|
1034
|
|
|
1
|
|
|
|
|
5
|
|
6
|
1
|
|
|
1
|
|
82
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
7
|
1
|
|
|
1
|
|
498
|
use Template::Tiny; |
|
1
|
|
|
|
|
1355
|
|
|
1
|
|
|
|
|
252
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.05_1'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $tt = Template::Tiny->new( TRIM => 0, ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub generate { |
14
|
1
|
|
|
1
|
1
|
99
|
my $ref = shift; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
6
|
$ref->{table_tree} = $ref->{table} . $ref->{postfix}; |
17
|
1
|
|
|
|
|
5
|
$ref->{program} = __PACKAGE__; |
18
|
1
|
|
|
|
|
43
|
$ref->{localtime} = scalar localtime; |
19
|
1
|
|
|
|
|
4
|
$ref->{version} = $VERSION; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
58
|
local $ref->{separator} = $ref->{separator} =~ s/'/''/gr; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
die 'path requires a name' |
24
|
1
|
50
|
33
|
|
|
9
|
if exists $ref->{path} and not exists $ref->{name}; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
7
|
my $dist_share = dist_share('SQL-Tree'); |
27
|
1
|
|
|
|
|
208
|
my $template = File::Spec->catfile( $dist_share, $ref->{driver} . '.sqlt' ); |
28
|
|
|
|
|
|
|
|
29
|
1
|
50
|
|
|
|
47
|
open my $fh, '<', $template or die 'unsupported driver: ' . $ref->{driver}; |
30
|
1
|
|
|
|
|
4
|
my $sqlt = do { local $/; <$fh> }; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
47
|
|
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
10
|
$tt->process( \$sqlt, $ref, \my $output ); |
33
|
1
|
|
|
|
|
24093
|
$output; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |