| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Oryx; |
|
2
|
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
391758
|
use Carp qw(carp croak); |
|
|
18
|
|
|
|
|
45
|
|
|
|
18
|
|
|
|
|
1467
|
|
|
4
|
18
|
|
|
18
|
|
16953
|
use UNIVERSAL qw(isa can); |
|
|
18
|
|
|
|
|
232
|
|
|
|
18
|
|
|
|
|
93
|
|
|
5
|
18
|
|
|
18
|
|
20432
|
use Oryx::Class; |
|
|
18
|
|
|
|
|
59
|
|
|
|
18
|
|
|
|
|
97
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.24'; |
|
8
|
|
|
|
|
|
|
our $DEBUG = 0; |
|
9
|
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
0
|
0
|
sub new { croak("abstract") } |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub import { |
|
13
|
33
|
|
|
33
|
|
199
|
my $class = shift; |
|
14
|
33
|
|
|
|
|
89
|
my %param = @_; |
|
15
|
33
|
50
|
|
|
|
169
|
if (defined $param{auto_deploy}) { |
|
16
|
0
|
|
|
|
|
0
|
Oryx::Class->auto_deploy($param{auto_deploy}); |
|
17
|
|
|
|
|
|
|
} |
|
18
|
33
|
50
|
|
|
|
745
|
if (defined $param{dont_cache}) { |
|
19
|
0
|
|
|
|
|
0
|
Oryx::Class->dont_cache($param{dont_cache}); |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub init { |
|
24
|
0
|
|
|
0
|
0
|
0
|
my ($self, $Class, $conn, $schema) = @_; |
|
25
|
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
0
|
$DEBUG && $self->_carp("SCHEMA => $schema, Class => $Class"); |
|
27
|
0
|
0
|
0
|
|
|
0
|
unless (ref($schema) and isa($schema, 'Oryx::Schema')) { |
|
28
|
0
|
0
|
|
|
|
0
|
$schema = 'Oryx::Schema' unless $schema; |
|
29
|
0
|
0
|
|
|
|
0
|
eval "use $schema"; croak($@) if $@; |
|
|
0
|
|
|
|
|
0
|
|
|
30
|
0
|
|
|
|
|
0
|
$schema = $schema->new; |
|
31
|
0
|
0
|
|
|
|
0
|
$DEBUG && $self->_carp("new schema instance => $schema"); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
0
|
$self->schema($schema); |
|
35
|
0
|
|
|
|
|
0
|
$self->set_util($conn->[0]); # $dsname |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
0
|
push @Oryx::Class::ISA, $Class; |
|
38
|
0
|
|
|
|
|
0
|
$self->Class($Class); |
|
39
|
0
|
|
|
|
|
0
|
$self->Class->storage($self); |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
0
|
if (%Oryx::Class::Orphans) { |
|
42
|
0
|
|
|
|
|
0
|
foreach (keys %Oryx::Class::Orphans) { |
|
43
|
0
|
|
|
|
|
0
|
eval { Oryx::Class::import($_) }; |
|
|
0
|
|
|
|
|
0
|
|
|
44
|
0
|
0
|
0
|
|
|
0
|
$DEBUG && $_->_carp($@) if $@; |
|
45
|
0
|
|
|
|
|
0
|
$schema->addClass($_); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
0
|
|
|
|
|
0
|
%Oryx::Class::Orphans = (); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub connect { |
|
52
|
15
|
|
|
15
|
0
|
1208160
|
my ($class, $conn, $schema) = @_; |
|
53
|
15
|
50
|
|
|
|
93
|
$schema = 'Oryx::Schema' unless $schema; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# determine the type of storage we're using from the dsn |
|
56
|
15
|
|
|
|
|
52
|
my $storage; |
|
57
|
15
|
50
|
|
|
|
127
|
if ($conn->[0] =~ /^dbm:/) { |
|
58
|
0
|
0
|
|
|
|
0
|
eval 'use Oryx::DBM'; $class->_croak($@) if $@; |
|
|
0
|
|
|
|
|
0
|
|
|
59
|
0
|
|
|
|
|
0
|
$storage = Oryx::DBM->new; |
|
60
|
|
|
|
|
|
|
} else { |
|
61
|
15
|
50
|
|
15
|
|
7812
|
eval 'use Oryx::DBI'; $class->_croak($@) if $@; |
|
|
15
|
|
|
|
|
58
|
|
|
|
15
|
|
|
|
|
175
|
|
|
|
15
|
|
|
|
|
839
|
|
|
|
15
|
|
|
|
|
87
|
|
|
62
|
15
|
|
|
|
|
93
|
$storage = Oryx::DBI->new; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
15
|
|
|
|
|
78
|
$storage->connect($conn, $schema); |
|
66
|
0
|
|
|
|
|
0
|
return $storage; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
0
|
|
0
|
1
|
0
|
sub Class { $_[0]->{Class} = $_[1] if $_[1]; $_[0]->{Class} } |
|
|
0
|
|
|
|
|
0
|
|
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# delegate to the actual implementing storage class |
|
72
|
|
|
|
|
|
|
sub deploySchema { |
|
73
|
0
|
|
|
0
|
0
|
0
|
my ($self, $schema) = @_; |
|
74
|
0
|
|
|
|
|
0
|
$self->Class->storage->deploySchema($schema); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub _carp { |
|
78
|
0
|
|
0
|
0
|
|
0
|
my $class = ref $_[0] || $_[0]; |
|
79
|
0
|
|
|
|
|
0
|
carp("[".$class."] $_[1]"); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub _croak { |
|
83
|
15
|
|
33
|
15
|
|
89
|
my $class = ref $_[0] || $_[0]; |
|
84
|
15
|
|
|
|
|
3644
|
croak("[".$class."] $_[1]"); |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |