improving MatrixListing performance

This commit is contained in:
Yung Han Khoe 2009-02-16 16:56:39 +00:00
parent d1680cf867
commit 60f44083bb

View file

@ -304,9 +304,9 @@ sub getEditForm {
[$category,$matrixId]); [$category,$matrixId]);
} }
else{ else{
$attributes = $db->read("select * from Matrix_attribute as a $attributes = $db->read("select * from Matrix_attribute as attribute
left join MatrixListing_attribute as l on (a.attributeId = l.attributeId and l.matrixListingId = ?) left join MatrixListing_attribute as listing using(attributeId)
where category =? and a.assetId = ?", where listing.matrixListingId = ? and category =? and attribute.assetId = ?",
[$self->getId,$category,$matrixId]); [$self->getId,$category,$matrixId]);
} }
while (my $attribute = $attributes->hashRef) { while (my $attribute = $attributes->hashRef) {
@ -604,9 +604,9 @@ sub view {
my $attributes; my $attributes;
my @attribute_loop; my @attribute_loop;
my $categoryLoopName = $session->url->urlize($category)."_loop"; my $categoryLoopName = $session->url->urlize($category)."_loop";
$attributes = $db->read("select * from Matrix_attribute as a $attributes = $db->read("select * from Matrix_attribute as attribute
left join MatrixListing_attribute as l on (a.attributeId = l.attributeId and l.matrixListingId = ?) left join MatrixListing_attribute as listing using(attributeId)
where category =? and a.assetId = ?", where listing.matrixListingId = ? and category =? and attribute.assetId = ?",
[$self->getId,$category,$self->getParent->getId]); [$self->getId,$category,$self->getParent->getId]);
while (my $attribute = $attributes->hashRef) { while (my $attribute = $attributes->hashRef) {
$attribute->{label} = $attribute->{name}; $attribute->{label} = $attribute->{name};
@ -784,7 +784,8 @@ pluginspage="http://www.macromedia.com/go/getflashplayer" />
); );
$var->{emailForm} = $mailForm->print; $var->{emailForm} = $mailForm->print;
return $self->getParent->processStyle($self->processTemplate($var,undef, $self->{_viewTemplate})); my $template = $self->processTemplate($var,undef, $self->{_viewTemplate});
return $self->getParent->processStyle($template);
} }
@ -879,9 +880,9 @@ sub www_getAttributes {
push(@results,{label=>$category,fieldType=>'category'}); push(@results,{label=>$category,fieldType=>'category'});
my $attributes; my $attributes;
my @attribute_loop; my @attribute_loop;
$attributes = $db->read("select * from Matrix_attribute as a $attributes = $db->read("select * from Matrix_attribute as attribute
left join MatrixListing_attribute as l on (a.attributeId = l.attributeId and l.matrixListingId = ?) left join MatrixListing_attribute as listing using(attributeId)
where category =? and a.assetId = ?", where listing.matrixListingId = ? and category =? and attribute.assetId = ?",
[$self->getId,$category,$self->getParent->getId]); [$self->getId,$category,$self->getParent->getId]);
while (my $attribute = $attributes->hashRef) { while (my $attribute = $attributes->hashRef) {
$attribute->{label} = $attribute->{name}; $attribute->{label} = $attribute->{name};