| File | /project/perllib/Wiki/DB/Wiki.pm |
| Statements Executed | 13 |
| Statement Execution Time | 1.05ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0s | 0s | Wiki::DB::Wiki::BEGIN |
| 0 | 0 | 0 | 0s | 0s | Wiki::DB::Wiki::get_full_name |
| 0 | 0 | 0 | 0s | 0s | Wiki::DB::Wiki::update_updated_on |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Wiki::DB::Wiki; | ||||
| 2 | 3 | 698µs | 1 | 466ms | use base qw(K2::DB2); # spent 466ms making 1 call to base::import |
| 3 | |||||
| 4 | 1 | 44µs | 1 | 401ms | __PACKAGE__->set_up_table('t_wiki'); # spent 401ms making 1 call to Class::DBI::Pg::set_up_table |
| 5 | 1 | 44µs | 1 | 193µs | __PACKAGE__->sequence('t_wiki_id_seq'); # spent 193µs making 1 call to Class::Data::Inheritable::__ANON__[Class/Data/Inheritable.pm:23] |
| 6 | |||||
| 7 | 1 | 25µs | 1 | 114ms | __PACKAGE__->has_a_datetime('updated_on'); # spent 114ms making 1 call to K2::DB2::has_a_datetime |
| 8 | 1 | 37µs | 1 | 47.6ms | __PACKAGE__->has_many(categories => 'Wiki::DB::WikiCategories', 'wiki_id'); # spent 47.6ms making 1 call to Class::DBI::__ANON__[Class/DBI.pm:1034] |
| 9 | 1 | 38µs | 1 | 2.38ms | __PACKAGE__->has_many(wikis => 'Wiki::DB::WikiCategories', 'category_id', { order_by => 'view_order' } ); # spent 2.38ms making 1 call to Class::DBI::__ANON__[Class/DBI.pm:1034] |
| 10 | 1 | 30µs | 1 | 216µs | __PACKAGE__->retrieve_all_sort_field('updated_on desc'); # spent 216µs making 1 call to Class::DBI::Plugin::RetrieveAll::__ANON__[Class/DBI/Plugin/RetrieveAll.pm:84] |
| 11 | 1 | 31µs | 1 | 182µs | __PACKAGE__->add_trigger(before_update => \&update_updated_on); # spent 182µs making 1 call to Class::DBI::add_trigger |
| 12 | |||||
| 13 | |||||
| 14 | sub get_full_name { | ||||
| 15 | my ($self) = @_; | ||||
| 16 | my $c = $self->categories->first; | ||||
| 17 | my $name = $c ? $c->category_id->get_full_name . ' - ' : ''; | ||||
| 18 | $name .= $self->title; | ||||
| 19 | return $name; | ||||
| 20 | } | ||||
| 21 | |||||
| 22 | |||||
| 23 | sub update_updated_on { | ||||
| 24 | my ($self) = @_; | ||||
| 25 | $self->updated_on(time); | ||||
| 26 | } | ||||
| 27 | |||||
| 28 | |||||
| 29 | 1 | 31µs | 1 | 589µs | __PACKAGE__->set_sql(parent_category => <<''); # spent 589µs making 1 call to Class::DBI::set_sql |
| 30 | SELECT * FROM __TABLE__ | ||||
| 31 | WHERE id IN ( SELECT distinct category_id FROM t_wiki_categories) | ||||
| 32 | ORDER BY title | ||||
| 33 | |||||
| 34 | |||||
| 35 | 1 | 29µs | 1 | 429µs | __PACKAGE__->set_sql(category => <<''); # spent 429µs making 1 call to Class::DBI::set_sql |
| 36 | SELECT * FROM __TABLE__ | ||||
| 37 | WHERE id IN ( SELECT distinct category_id FROM t_wiki_categories | ||||
| 38 | WHERE category_id IN (SELECT distinct category_id FROM t_wiki_categories) AND | ||||
| 39 | category_id NOT IN (SELECT distinct wiki_id FROM t_wiki_categories)) | ||||
| 40 | ORDER BY title | ||||
| 41 | |||||
| 42 | |||||
| 43 | 1 | 41µs | 1; |