line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pinwheel::Database::Sqlite; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
15
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
108
|
|
4
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
84
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
2088
|
use Pinwheel::Database::Base; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
562
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Pinwheel::Database::Base); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new |
12
|
|
|
|
|
|
|
{ |
13
|
2
|
|
|
2
|
0
|
7
|
my $class = shift; |
14
|
2
|
|
|
|
|
18
|
my $self = $class->SUPER::new(@_); |
15
|
2
|
|
|
|
|
6
|
bless $self, $class; # Re-bless into this class |
16
|
2
|
|
|
|
|
11
|
return $self; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub connect |
20
|
|
|
|
|
|
|
{ |
21
|
14
|
|
|
14
|
0
|
25
|
my $self = shift; |
22
|
14
|
|
|
|
|
77
|
$self->SUPER::connect(@_); |
23
|
14
|
|
|
|
|
46
|
$self->{dbhostname} = 'localhost'; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub describe |
27
|
|
|
|
|
|
|
{ |
28
|
27
|
|
|
27
|
0
|
79
|
my ($self ,$table) = @_; |
29
|
27
|
|
|
|
|
76
|
my ($sth, $rows, %fields); |
30
|
27
|
|
|
|
|
266
|
$sth = $self->prepare("PRAGMA table_info (`$table`)"); |
31
|
27
|
|
|
|
|
5425
|
$sth->execute(); |
32
|
27
|
|
|
|
|
563
|
$rows = $sth->fetchall_arrayref([1, 2, 3]); |
33
|
83
|
100
|
|
|
|
630
|
map { |
34
|
27
|
|
|
|
|
2632
|
$fields{$_->[0]} = { type => lc($_->[1]), null => ($_->[2] ? 0 : 1) } |
35
|
|
|
|
|
|
|
} @$rows; |
36
|
27
|
|
|
|
|
165
|
return \%fields; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub tables |
40
|
|
|
|
|
|
|
{ |
41
|
7
|
|
|
7
|
0
|
18
|
my $self = shift; |
42
|
7
|
|
|
|
|
50
|
return $self->selectcol_array('SELECT tbl_name FROM sqlite_master WHERE type="table"'); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__DATA__ |