line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBD::SQLite::BundledExtensions; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Provides a number of C extensions for DBD::SQLite and some functions to help load them |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
28453
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1843
|
use File::Find; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
54
|
|
8
|
1
|
|
|
1
|
|
7
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
263
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION="0.003"; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
for my $ext (qw/spellfix csv ieee754 nextchar percentile series totype wholenumber eval/) { |
13
|
0
|
|
|
0
|
1
|
0
|
eval "sub load_${ext} {my (\$self, \$dbh)=\@_; \$self->_load_extension(\$dbh, '${ext}')}"; |
|
0
|
|
|
0
|
1
|
0
|
|
|
0
|
|
|
0
|
1
|
0
|
|
|
0
|
|
|
0
|
1
|
0
|
|
|
0
|
|
|
0
|
1
|
0
|
|
|
0
|
|
|
0
|
1
|
0
|
|
|
0
|
|
|
0
|
1
|
0
|
|
|
0
|
|
|
0
|
1
|
0
|
|
|
0
|
|
|
0
|
1
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _load_extension { |
17
|
9
|
|
|
9
|
|
17803
|
my ($self, $dbh, $extension_name) = @_; |
18
|
|
|
|
|
|
|
|
19
|
9
|
|
|
|
|
24
|
my $file = $self->_locate_extension_library($extension_name); |
20
|
|
|
|
|
|
|
|
21
|
9
|
|
|
|
|
56
|
$dbh->sqlite_enable_load_extension(1); |
22
|
9
|
50
|
|
|
|
48
|
$dbh->do("select load_extension(?)", {}, $file) |
23
|
|
|
|
|
|
|
or die "Cannot load '$extension_name' extension: " . $dbh->errstr(); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _locate_extension_library { |
27
|
9
|
|
|
9
|
|
21
|
my ($self, $extension_name) = @_; |
28
|
9
|
|
|
|
|
14
|
my $sofile; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $wanted = sub { |
31
|
107
|
|
|
107
|
|
281
|
my $file = $File::Find::name; |
32
|
|
|
|
|
|
|
|
33
|
107
|
100
|
|
|
|
5089
|
if ($file =~ m/DBD-SQLite-BundledExtensions.\Q$extension_name\E\.(so|dll|dylib)$/i){ |
34
|
9
|
|
|
|
|
20
|
$sofile = $file; |
35
|
9
|
|
|
|
|
134
|
die; # bail out on the first one we find, this might need to be more configurable |
36
|
|
|
|
|
|
|
} |
37
|
9
|
|
|
|
|
48
|
}; |
38
|
|
|
|
|
|
|
|
39
|
9
|
|
|
|
|
18
|
eval {find({wanted => $wanted, no_chdir => 1}, @INC);}; |
|
9
|
|
|
|
|
636
|
|
40
|
|
|
|
|
|
|
|
41
|
9
|
50
|
|
|
|
37
|
if ($sofile) { |
42
|
9
|
|
|
|
|
129
|
$sofile = File::Spec->rel2abs($sofile); # Make it an absolute path, if it isn't already. Aids in portability |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
9
|
|
|
|
|
54
|
return $sofile; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
__END__ |