line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Apache::AxKit::Provider::RDBMS; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
21992
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
461
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our @ISA = qw( Apache::AxKit::Provider ); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Preloaded methods go here. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
## private methods |
14
|
|
|
|
|
|
|
our $loadModule; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub init { |
17
|
0
|
|
|
0
|
0
|
|
my $this = shift; |
18
|
0
|
|
|
|
|
|
my ( %p ) = @_; |
19
|
0
|
|
|
|
|
|
my $r = $this->{apache}; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $adapter = $r->dir_config( "RDBMSCacheAdapter" ); |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
if( ! defined $adapter ) { |
24
|
0
|
|
|
|
|
|
$adapter = "Apache::AxKit::Provider::RDBMS::DBCacheAdapter::SQLite"; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $content_provider = $r->dir_config( "RDBMSContentProvider" ); |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
if( ! defined $content_provider ) { |
31
|
0
|
|
|
|
|
|
$content_provider = "Apache::AxKit::Provider::RDBMS::ContentProvider::SQL"; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
$this->$loadModule( $adapter ); |
35
|
0
|
|
|
|
|
|
$this->$loadModule( $content_provider ); |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
$this->{cacheAdapter} = $adapter->new( $this->{apache} ); |
38
|
0
|
|
|
|
|
|
$this->{contentAdapter} = $content_provider->new( $this->{apache} ); |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$this->{key} = $this->{apache}->location; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$loadModule = sub { |
44
|
|
|
|
|
|
|
my $this = shift; |
45
|
|
|
|
|
|
|
my $module = shift; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
$module =~ s/::/\//g; |
48
|
|
|
|
|
|
|
$module .= ".pm"; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
require $module; |
51
|
|
|
|
|
|
|
}; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub mtime { |
54
|
0
|
|
|
0
|
0
|
|
my $this = shift; |
55
|
0
|
|
|
|
|
|
return $this->{cacheAdapter}->mtime(); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub get_strref { |
60
|
0
|
|
|
0
|
0
|
|
my $this = shift; |
61
|
0
|
|
|
|
|
|
my $content; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
## work-around axit-bug |
64
|
0
|
0
|
|
|
|
|
if( ! defined $this->{xml} ) { |
65
|
0
|
|
|
|
|
|
$this->{xml} = $this->{contentAdapter}->getContent(); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
$content = $this->{xml}; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
return \$content; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub key { |
74
|
0
|
|
|
0
|
0
|
|
return $_[0]->{key}; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub process { |
78
|
0
|
|
|
0
|
0
|
|
return 1; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |