line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
package DBI::Test; |
3
|
25
|
|
|
25
|
|
437597
|
use base 'Class::DBI'; |
|
25
|
|
|
|
|
39
|
|
|
25
|
|
|
|
|
17160
|
|
4
|
25
|
|
|
25
|
|
1172758
|
use Class::DBI::Plugin::Type; |
|
25
|
|
|
|
|
6312
|
|
|
25
|
|
|
|
|
125
|
|
5
|
25
|
|
|
25
|
|
17071
|
use Class::DBI::FormBuilder; |
|
25
|
|
|
|
|
53
|
|
|
25
|
|
|
|
|
179
|
|
6
|
|
|
|
|
|
|
# use the db set up in 01.create.t |
7
|
|
|
|
|
|
|
DBI::Test->set_db("Main", "dbi:SQLite2:dbname=test.db"); |
8
|
|
|
|
|
|
|
# DBI::Test->table("test"); |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
{ # might_have |
12
|
|
|
|
|
|
|
package Job; |
13
|
25
|
|
|
25
|
|
159
|
use base 'DBI::Test'; |
|
25
|
|
|
|
|
28
|
|
|
25
|
|
|
|
|
2993
|
|
14
|
|
|
|
|
|
|
Job->table( 'job' ); |
15
|
|
|
|
|
|
|
Job->columns( All => qw/id person jobtitle employer salary/ ); |
16
|
|
|
|
|
|
|
Job->columns( Stringify => qw/jobtitle/ ); |
17
|
|
|
|
|
|
|
Job->has_a( person => 'Person' ); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
{ # has_a |
21
|
|
|
|
|
|
|
package Town; |
22
|
25
|
|
|
25
|
|
102
|
use base 'DBI::Test'; |
|
25
|
|
|
|
|
25
|
|
|
25
|
|
|
|
|
1960
|
|
23
|
|
|
|
|
|
|
#Town->form_builder_defaults( { smartness => 3 } ); |
24
|
|
|
|
|
|
|
Town->table("town"); |
25
|
|
|
|
|
|
|
Town->columns(All => qw/id name pop lat long country/); |
26
|
|
|
|
|
|
|
Town->columns(Stringify => qw/name/); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
{ # has_many |
30
|
|
|
|
|
|
|
# this one must be declared before Person, because Person will |
31
|
|
|
|
|
|
|
# examine the has_a in Toy when setting up its has_many toys. |
32
|
|
|
|
|
|
|
package Toy; |
33
|
25
|
|
|
25
|
|
107
|
use base 'DBI::Test'; |
|
25
|
|
|
|
|
33
|
|
|
25
|
|
|
|
|
2275
|
|
34
|
|
|
|
|
|
|
Toy->table('toy'); |
35
|
|
|
|
|
|
|
Toy->columns( All => qw/id person name descr/ ); |
36
|
|
|
|
|
|
|
Toy->columns( Stringify => qw/name/ ); |
37
|
|
|
|
|
|
|
Toy->has_a( person => 'Person' ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
{ |
41
|
|
|
|
|
|
|
package Person; |
42
|
25
|
|
|
25
|
|
101
|
use base 'DBI::Test'; |
|
25
|
|
|
|
|
37
|
|
|
25
|
|
|
|
|
2545
|
|
43
|
|
|
|
|
|
|
#Person->form_builder_defaults( { smartness => 3 } ); |
44
|
|
|
|
|
|
|
Person->table("person"); |
45
|
|
|
|
|
|
|
Person->columns(All => qw/id name town street/); |
46
|
|
|
|
|
|
|
Person->columns(Stringify => qw/name/); |
47
|
|
|
|
|
|
|
Person->has_a( town => 'Town' ); |
48
|
|
|
|
|
|
|
Person->has_many( toys => 'Toy' ); |
49
|
|
|
|
|
|
|
Person->might_have( job => Job => qw/jobtitle employer salary/ ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |