← Index
NYTProf Performance Profile   « line view »
For starman worker -M FindBin --max-requests 50 --workers 2 --user=kohadev-koha --group kohadev-koha --pid /var/run/koha/kohadev/plack.pid --daemonize --access-log /var/log/koha/kohadev/plack.log --error-log /var/log/koha/kohadev/plack-error.log -E deployment --socket /var/run/koha/kohadev/plack.sock /etc/koha/sites/kohadev/plack.psgi
  Run on Fri Jan 8 14:16:49 2016
Reported on Fri Jan 8 14:23:08 2016

Filename/usr/share/perl5/DBIx/Class/PK.pm
StatementsExecuted 0 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11118µs25µsDBIx::Class::PK::::BEGIN@3DBIx::Class::PK::BEGIN@3
1118µs46µsDBIx::Class::PK::::BEGIN@6DBIx::Class::PK::BEGIN@6
1117µs12µsDBIx::Class::PK::::BEGIN@4DBIx::Class::PK::BEGIN@4
0000s0sDBIx::Class::PK::::IDDBIx::Class::PK::ID
0000s0sDBIx::Class::PK::::_create_IDDBIx::Class::PK::_create_ID
0000s0sDBIx::Class::PK::::_ident_valuesDBIx::Class::PK::_ident_values
0000s0sDBIx::Class::PK::::_mk_ident_condDBIx::Class::PK::_mk_ident_cond
0000s0sDBIx::Class::PK::::_storage_ident_conditionDBIx::Class::PK::_storage_ident_condition
0000s0sDBIx::Class::PK::::idDBIx::Class::PK::id
0000s0sDBIx::Class::PK::::ident_conditionDBIx::Class::PK::ident_condition
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package DBIx::Class::PK;
2
3232µs
# spent 25µs (18+7) within DBIx::Class::PK::BEGIN@3 which was called: # once (18µs+7µs) by Class::C3::Componentised::ensure_class_loaded at line 3
use strict;
# spent 25µs making 1 call to DBIx::Class::PK::BEGIN@3 # spent 7µs making 1 call to strict::import
4216µs
# spent 12µs (7+4) within DBIx::Class::PK::BEGIN@4 which was called: # once (7µs+4µs) by Class::C3::Componentised::ensure_class_loaded at line 4
use warnings;
# spent 12µs making 1 call to DBIx::Class::PK::BEGIN@4 # spent 4µs making 1 call to warnings::import
5
6246µs
# spent 46µs (8+38) within DBIx::Class::PK::BEGIN@6 which was called: # once (8µs+38µs) by Class::C3::Componentised::ensure_class_loaded at line 6
use base qw/DBIx::Class::Row/;
# spent 46µs making 1 call to DBIx::Class::PK::BEGIN@6 # spent 38µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 38µs
7
8=head1 NAME
9
10DBIx::Class::PK - Primary Key class
11
12=head1 SYNOPSIS
13
14=head1 DESCRIPTION
15
16This class contains methods for handling primary keys and methods
17depending on them.
18
19=head1 METHODS
20
21=cut
22
23=head2 id
24
25Returns the primary key(s) for a row. Can't be called as
26a class method.
27
28=cut
29
30sub id {
31 my ($self) = @_;
32 $self->throw_exception( "Can't call id() as a class method" )
33 unless ref $self;
34 my @id_vals = $self->_ident_values;
35 return (wantarray ? @id_vals : $id_vals[0]);
36}
37
38sub _ident_values {
39 my ($self, $use_storage_state) = @_;
40
41 my (@ids, @missing);
42
43 for ($self->result_source->_pri_cols_or_die) {
44 push @ids, ($use_storage_state and exists $self->{_column_data_in_storage}{$_})
45 ? $self->{_column_data_in_storage}{$_}
46 : $self->get_column($_)
47 ;
48 push @missing, $_ if (! defined $ids[-1] and ! $self->has_column_loaded ($_) );
49 }
50
51 if (@missing && $self->in_storage) {
52 $self->throw_exception (
53 'Unable to uniquely identify result object with missing PK columns: '
54 . join (', ', @missing )
55 );
56 }
57
58 return @ids;
59}
60
61=head2 ID
62
63Returns a unique id string identifying a result object by primary key.
64Used by L<DBIx::Class::CDBICompat::LiveObjectIndex> and
65L<DBIx::Class::ObjectCache>.
66
67=over
68
69=item WARNING
70
71The default C<_create_ID> method used by this function orders the returned
72values by the alphabetical order of the primary column names, B<unlike>
73the L</id> method, which follows the same order in which columns were fed
74to L<DBIx::Class::ResultSource/set_primary_key>.
75
76=back
77
78=cut
79
80sub ID {
81 my ($self) = @_;
82 $self->throw_exception( "Can't call ID() as a class method" )
83 unless ref $self;
84 return undef unless $self->in_storage;
85 return $self->_create_ID(%{$self->ident_condition});
86}
87
88sub _create_ID {
89 my ($self, %vals) = @_;
90 return undef if grep { !defined } values %vals;
91 return join '|', ref $self || $self, $self->result_source->name,
92 map { $_ . '=' . $vals{$_} } sort keys %vals;
93}
94
95=head2 ident_condition
96
97 my $cond = $result_source->ident_condition();
98
99 my $cond = $result_source->ident_condition('alias');
100
101Produces a condition hash to locate a row based on the primary key(s).
102
103=cut
104
105sub ident_condition {
106 shift->_mk_ident_cond(@_);
107}
108
109sub _storage_ident_condition {
110 shift->_mk_ident_cond(shift, 1);
111}
112
113sub _mk_ident_cond {
114 my ($self, $alias, $use_storage_state) = @_;
115
116 my @pks = $self->result_source->_pri_cols_or_die;
117 my @vals = $self->_ident_values($use_storage_state);
118
119 my (%cond, @undef);
120 my $prefix = defined $alias ? $alias.'.' : '';
121 for my $col (@pks) {
122 if (! defined ($cond{$prefix.$col} = shift @vals) ) {
123 push @undef, $col;
124 }
125 }
126
127 if (@undef && $self->in_storage) {
128 $self->throw_exception (
129 'Unable to construct result object identity condition due to NULL PK columns: '
130 . join (', ', @undef)
131 );
132 }
133
134 return \%cond;
135}
136
137=head1 FURTHER QUESTIONS?
138
139Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
140
141=head1 COPYRIGHT AND LICENSE
142
143This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
144by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
145redistribute it and/or modify it under the same terms as the
146L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
147
148=cut
149
1501;