File | /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/Relationship/HasMany.pm | Statements Executed | 23 | Total Time | 0.000483 seconds |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine | |
---|---|---|---|---|---|---|
1 | 1 | 1 | 0.00014 | 0.01395 | DBIx::Class::Relationship::HasMany:: | has_many |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Relationship::HasMany:: | BEGIN |
Line | Stmts. | Exclusive Time | Avg. | Code |
---|---|---|---|---|
1 | package # hide from PAUSE | |||
2 | DBIx::Class::Relationship::HasMany; | |||
3 | ||||
4 | 3 | 3.3e-5 | 1.1e-5 | use strict; # spent 11µs making 1 call to strict::import |
5 | 3 | 0.00028 | 9.5e-5 | use warnings; # spent 22µs making 1 call to warnings::import |
6 | ||||
7 | # spent 13.9ms (141µs+13.8) within DBIx::Class::Relationship::HasMany::has_many which was called
# once (141µs+13.8ms) at line 44 of /wise/base/deliv/dev/lib/perl/WISE/DB/FrameIndex/Scan.pm | |||
8 | 3 | 3.2e-5 | 1.1e-5 | my ($class, $rel, $f_class, $cond, $attrs) = @_; |
9 | ||||
10 | 9 | 8.9e-5 | 9.9e-6 | unless (ref $cond) { |
11 | $class->ensure_class_loaded($f_class); # spent 13.4ms making 1 call to Class::C3::Componentised::ensure_class_loaded, max recursion depth 1 | |||
12 | my ($pri, $too_many) = $class->primary_columns; # spent 79µs making 1 call to DBIx::Class::ResultSourceProxy::primary_columns | |||
13 | ||||
14 | $class->throw_exception( | |||
15 | "has_many can only infer join for a single primary key; ". | |||
16 | "${class} has more" | |||
17 | ) if $too_many; | |||
18 | ||||
19 | $class->throw_exception( | |||
20 | "has_many needs a primary key to infer a join; ". | |||
21 | "${class} has none" | |||
22 | ) if !defined $pri && (!defined $cond || !length $cond); | |||
23 | ||||
24 | my ($f_key,$guess); | |||
25 | 3 | 1.6e-5 | 5.3e-6 | if (defined $cond && length $cond) { |
26 | $f_key = $cond; | |||
27 | $guess = "caller specified foreign key '$f_key'"; | |||
28 | } else { | |||
29 | $class =~ /([^\:]+)$/; | |||
30 | $f_key = lc $1; # go ahead and guess; best we can do | |||
31 | $guess = "using our class name '$class' as foreign key"; | |||
32 | } | |||
33 | ||||
34 | 1 | 2.6e-5 | 2.6e-5 | my $f_class_loaded = eval { $f_class->columns }; # spent 79µs making 1 call to DBIx::Class::ResultSourceProxy::columns |
35 | $class->throw_exception( # spent 63µs making 1 call to DBIx::Class::ResultSourceProxy::has_column | |||
36 | "No such column ${f_key} on foreign class ${f_class} ($guess)" | |||
37 | ) if $f_class_loaded && !$f_class->has_column($f_key); | |||
38 | ||||
39 | $cond = { "foreign.${f_key}" => "self.${pri}" }; | |||
40 | } | |||
41 | ||||
42 | $class->add_relationship($rel, $f_class, $cond, { | |||
43 | accessor => 'multi', | |||
44 | join_type => 'LEFT', | |||
45 | cascade_delete => 1, | |||
46 | cascade_copy => 1, | |||
47 | %{$attrs||{}} # spent 206µs making 1 call to DBIx::Class::ResultSourceProxy::add_relationship | |||
48 | }); | |||
49 | } | |||
50 | ||||
51 | 1 | 3.0e-6 | 3.0e-6 | 1; |