line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package |
3
|
|
|
|
|
|
|
Class::DBI::Lite::EntityMeta; |
4
|
|
|
|
|
|
|
|
5
|
17
|
|
|
17
|
|
100
|
use strict; |
|
17
|
|
|
|
|
27
|
|
|
17
|
|
|
|
|
462
|
|
6
|
17
|
|
|
17
|
|
82
|
use warnings 'all'; |
|
17
|
|
|
|
|
31
|
|
|
17
|
|
|
|
|
4775
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our %instances = ( ); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#============================================================================== |
12
|
|
|
|
|
|
|
sub new |
13
|
|
|
|
|
|
|
{ |
14
|
51
|
|
|
51
|
0
|
130
|
my ($s, $forClass, $schema, $entity) = @_; |
15
|
|
|
|
|
|
|
|
16
|
51
|
|
|
|
|
140
|
my $key = join ':', ( $schema, $entity ); |
17
|
51
|
100
|
|
|
|
152
|
if( my $inst = $instances{$key} ) |
18
|
|
|
|
|
|
|
{ |
19
|
1
|
|
|
|
|
3
|
return $inst; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
else |
22
|
|
|
|
|
|
|
{ |
23
|
50
|
|
|
|
|
448
|
return $instances{$key} = bless { |
24
|
|
|
|
|
|
|
table => $entity, # Class-based |
25
|
|
|
|
|
|
|
triggers => { # Class-based |
26
|
|
|
|
|
|
|
before_create => [ ], |
27
|
|
|
|
|
|
|
after_create => [ ], |
28
|
|
|
|
|
|
|
before_update => [ ], |
29
|
|
|
|
|
|
|
after_update => [ ], |
30
|
|
|
|
|
|
|
before_delete => [ ], |
31
|
|
|
|
|
|
|
after_delete => [ ], |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
has_a_rels => { }, # Class-based |
34
|
|
|
|
|
|
|
has_many_rels => { }, # Class-based, |
35
|
|
|
|
|
|
|
columns => $forClass->get_meta_columns( $schema, $entity ), |
36
|
|
|
|
|
|
|
trace => 0, |
37
|
|
|
|
|
|
|
}, $s; |
38
|
|
|
|
|
|
|
}# end if() |
39
|
|
|
|
|
|
|
}# end new() |
40
|
|
|
|
|
|
|
|
41
|
1
|
50
|
|
1
|
0
|
3
|
sub table { my $s = shift; @_ ? $s->{table} = shift : $s->{table} } |
|
1
|
|
|
|
|
10
|
|
42
|
1
|
50
|
|
1
|
0
|
3
|
sub triggers { my $s = shift; @_ ? $s->{triggers} = shift : $s->{triggers} } |
|
1
|
|
|
|
|
14
|
|
43
|
1
|
50
|
|
1
|
0
|
4
|
sub has_a_rels { my $s = shift; @_ ? $s->{has_a_rels} = shift : $s->{has_a_rels} } |
|
1
|
|
|
|
|
10
|
|
44
|
1
|
50
|
|
1
|
0
|
4
|
sub has_many_rels { my $s = shift; @_ ? $s->{has_many_rels} = shift : $s->{has_many_rels} } |
|
1
|
|
|
|
|
9
|
|
45
|
12951
|
50
|
|
12951
|
0
|
16767
|
sub columns { my $s = shift; @_ ? $s->{columns} = shift : $s->{columns} } |
|
12951
|
|
|
|
|
53752
|
|
46
|
11754
|
50
|
|
11754
|
0
|
14988
|
sub trace { my $s = shift; @_ ? $s->{trace} = shift : $s->{trace} } |
|
11754
|
|
|
|
|
32594
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1;# return true: |
49
|
|
|
|
|
|
|
|