Performance improvements to version and application classes. Reduce the amount of queries to

what is necessary during object creation.  The only use of all but one of the arrays we were fetching
during version and application construction was in ::delete() so we can just retrieve them there.
Speed screenshot class up by only querying for necessary columns, not select *
This commit is contained in:
Chris Morgan
2006-07-09 00:48:33 +00:00
committed by WineHQ
parent d06cba3977
commit 0a9f8cc155
5 changed files with 148 additions and 138 deletions

View File

@@ -25,7 +25,6 @@ class Application {
var $sSubmitTime;
var $iSubmitterId;
var $aVersionsIds; // an array that contains the versionId of every version linked to this app.
var $aUrlsIds; // an array that contains the screenshotId of every url linked to this version
/**
* constructor, fetches the data.
@@ -77,24 +76,6 @@ class Application {
$this->aVersionsIds[] = $oRow->versionId;
}
}
/*
* We fetch urlsIds.
*/
$this->aUrlsIds = array();
$sQuery = "SELECT id
FROM appData
WHERE type = 'url'
AND appId = '?'";
if($hResult = query_parameters($sQuery, $iAppId))
{
while($oRow = mysql_fetch_object($hResult))
{
$this->aUrlsIds[] = $oRow->id;
}
}
}
}
@@ -219,7 +200,24 @@ class Application {
$oVersion = new Version($iVersionId);
$oVersion->delete($bSilent);
}
foreach($this->aUrlsIds as $iUrlId)
/* fetch urlsIds */
$aUrlsIds = array();
$sQuery = "SELECT id
FROM appData
WHERE type = 'url'
AND appId = '?'";
if($hResult = query_parameters($sQuery, $this->iAppId))
{
while($oRow = mysql_fetch_object($hResult))
{
$aUrlsIds[] = $oRow->id;
}
}
foreach($aUrlsIds as $iUrlId)
{
$oUrl = new Url($iUrlId);
$oUrl->delete($bSilent);