Ignore:
Timestamp:
01/04/17 12:16:26 (7 years ago)
Author:
nanardon
Message:

Speed up attribute registration checks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm

    r1910 r1911  
    9898        $self->log(LA_DEBUG, 'New connection to DB'); 
    9999 
     100 
    100101        foreach my $otype ($self->list_supported_objects) { 
     102            my %attrlist = map { $_ => 1 } $self->list_registered_attributes($otype); 
    101103            foreach my $attribute ($self->list_canonical_fields($otype, 'r')) { 
    102104                my $attr = $self->attribute($otype, $attribute); 
     
    104106                $attr->{managed} and next; 
    105107 
    106                 if ($self->is_registered_attribute($otype, $attribute)) { 
     108                if ($attrlist{$attribute}) { 
    107109                } else { 
    108110                    if($self->register_attribute($otype, $attribute, $attr->{comment})) { 
     
    778780} 
    779781 
     782=head2 list_registered_attributes ($otype) 
     783 
     784List all regiestered attribute 
     785 
     786=cut 
     787 
     788sub list_registered_attributes { 
     789    my ($self, $otype) = @_; 
     790    my $pclass = $self->_load_obj_class($otype) or return; 
     791    if ($pclass->_has_extended_attributes) { 
     792        return $pclass->list_registered_attributes($self); 
     793    } else { 
     794        return (); 
     795    } 
     796} 
     797 
    780798=head2 get_attribute_comment ($otype, $attribute) 
    781799 
Note: See TracChangeset for help on using the changeset viewer.