line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::bif::show::table; |
2
|
1
|
|
|
1
|
|
3850
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
4
|
use Bif::Mo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
5
|
1
|
|
|
1
|
|
499
|
use DBIx::ThinSQL qw/sq/; |
|
1
|
|
|
|
|
28840
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.1.5_5'; |
8
|
|
|
|
|
|
|
extends 'App::bif::show'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub run { |
11
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
12
|
1
|
|
|
|
|
3
|
my $opts = $self->opts; |
13
|
1
|
|
|
|
|
5
|
my $db = $self->db; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $sql = $db->xval( |
16
|
|
|
|
|
|
|
select => 'sql', |
17
|
|
|
|
|
|
|
from => 'sqlite_master', |
18
|
0
|
|
|
|
|
|
where => { tbl_name => $opts->{name}, type => 'table' }, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
return $self->err( 'TableNotFound', 'table not found: %s', $opts->{name} ) |
22
|
0
|
0
|
|
|
|
|
unless $sql; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
$self->start_pager; |
25
|
0
|
|
|
|
|
|
print $sql, "\n"; |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
return $self->ok('ShowTable') unless $opts->{full}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my @rest = $db->xvals( |
30
|
|
|
|
|
|
|
select => [ qw/sql/, ], |
31
|
|
|
|
|
|
|
from => 'sqlite_master', |
32
|
|
|
|
|
|
|
where => { |
33
|
|
|
|
|
|
|
tbl_name => $opts->{name}, |
34
|
0
|
|
|
|
|
|
type => [qw/index trigger/], |
35
|
|
|
|
|
|
|
'name not like' => 'sqlite_%', |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
order_by => [ |
38
|
|
|
|
|
|
|
'name LIKE "%_bi_%" DESC', |
39
|
|
|
|
|
|
|
'name LIKE "%_ai_%" DESC', |
40
|
|
|
|
|
|
|
'name LIKE "%_bu_%" DESC', |
41
|
|
|
|
|
|
|
'name LIKE "%_au_%" DESC', |
42
|
|
|
|
|
|
|
'name LIKE "%_bd_%" DESC', |
43
|
|
|
|
|
|
|
'name LIKE "%_ad_%" DESC', |
44
|
|
|
|
|
|
|
], |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
if (@rest) { |
48
|
0
|
|
|
|
|
|
my ( $yellow, $reset ) = $self->colours( 'yellow', 'reset' ); |
49
|
0
|
|
|
|
|
|
my $joiner = "\n" . $yellow . ( '-' x 72 ) . $reset . "\n\n"; |
50
|
0
|
|
|
|
|
|
print $joiner, join( "\n" . $joiner, @rest ), "\n"; |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
return $self->ok('ShowFullTable'); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
__END__ |