File | /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/Relationship/HasOne.pm | Statements Executed | 12 | Total Time | 0.000449 seconds |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine | |
---|---|---|---|---|---|---|
1 | 1 | 1 | 3.3e-5 | 0.00036 | DBIx::Class::Relationship::HasOne:: | _has_one |
1 | 1 | 1 | 2.8e-5 | 0.00039 | DBIx::Class::Relationship::HasOne:: | has_one |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Relationship::HasOne:: | BEGIN |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Relationship::HasOne:: | might_have |
Line | Stmts. | Exclusive Time | Avg. | Code |
---|---|---|---|---|
1 | package # hide from PAUSE | |||
2 | DBIx::Class::Relationship::HasOne; | |||
3 | ||||
4 | 3 | 3.4e-5 | 1.1e-5 | use strict; # spent 11µs making 1 call to strict::import |
5 | 3 | 0.00035 | 0.00012 | use warnings; # spent 23µs making 1 call to warnings::import |
6 | ||||
7 | sub might_have { | |||
8 | shift->_has_one('LEFT' => @_); | |||
9 | } | |||
10 | ||||
11 | # spent 386µs (28+358) within DBIx::Class::Relationship::HasOne::has_one which was called
# once (28µs+358µs) at line 80 of /wise/base/deliv/dev/lib/perl/WISE/DB/FrameIndex/Frame.pm | |||
12 | 1 | 2.7e-5 | 2.7e-5 | shift->_has_one(undef() => @_); # spent 358µs making 1 call to DBIx::Class::Relationship::HasOne::_has_one |
13 | } | |||
14 | ||||
15 | # spent 358µs (33+325) within DBIx::Class::Relationship::HasOne::_has_one which was called
# once (33µs+325µs) by DBIx::Class::Relationship::HasOne::has_one at line 12 | |||
16 | 1 | 4.0e-6 | 4.0e-6 | my ($class, $join_type, $rel, $f_class, $cond, $attrs) = @_; |
17 | 1 | 1.0e-6 | 1.0e-6 | unless (ref $cond) { |
18 | $class->ensure_class_loaded($f_class); | |||
19 | my ($pri, $too_many) = $class->primary_columns; | |||
20 | ||||
21 | $class->throw_exception( | |||
22 | "might_have/has_one can only infer join for a single primary key; ". | |||
23 | "${class} has more" | |||
24 | ) if $too_many; | |||
25 | ||||
26 | $class->throw_exception( | |||
27 | "might_have/has_one needs a primary key to infer a join; ". | |||
28 | "${class} has none" | |||
29 | ) if !defined $pri && (!defined $cond || !length $cond); | |||
30 | ||||
31 | my $f_class_loaded = eval { $f_class->columns }; | |||
32 | my ($f_key,$guess); | |||
33 | if (defined $cond && length $cond) { | |||
34 | $f_key = $cond; | |||
35 | $guess = "caller specified foreign key '$f_key'"; | |||
36 | } elsif ($f_class_loaded && $f_class->has_column($rel)) { | |||
37 | $f_key = $rel; | |||
38 | $guess = "using given relationship '$rel' for foreign key"; | |||
39 | } else { | |||
40 | ($f_key, $too_many) = $f_class->primary_columns; | |||
41 | $class->throw_exception( | |||
42 | "might_have/has_one can only infer join for a single primary key; ". | |||
43 | "${f_class} has more" | |||
44 | ) if $too_many; | |||
45 | $guess = "using primary key of foreign class for foreign key"; | |||
46 | } | |||
47 | $class->throw_exception( | |||
48 | "No such column ${f_key} on foreign class ${f_class} ($guess)" | |||
49 | ) if $f_class_loaded && !$f_class->has_column($f_key); | |||
50 | $cond = { "foreign.${f_key}" => "self.${pri}" }; | |||
51 | } | |||
52 | $class->add_relationship($rel, $f_class, | |||
53 | $cond, | |||
54 | { accessor => 'single', | |||
55 | cascade_update => 1, cascade_delete => 1, | |||
56 | ($join_type ? ('join_type' => $join_type) : ()), | |||
57 | 1 | 2.8e-5 | 2.8e-5 | %{$attrs || {}} }); # spent 325µs making 1 call to DBIx::Class::ResultSourceProxy::add_relationship |
58 | 1 | 1.0e-6 | 1.0e-6 | 1; |
59 | } | |||
60 | ||||
61 | 1 | 3.0e-6 | 3.0e-6 | 1; |