Speedup appData::objectGetEntriesCount() when selecting un-queued entries or we are an admin.

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-05-28 20:10:49 +00:00
committed by WineHQ
parent e666a5c52e
commit 9ad365e1bd

View File

@@ -203,45 +203,55 @@ class appData
$sQuery .= " AND type = '?'";
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
$sType);
} else {
} else
{
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId);
}
} else
{
$sQuery = "SELECT COUNT(DISTINCT appData.id) as count FROM appData,
if($sQueued == "true" || $sQueued == "false")
$sAppDataQueued = " AND appData.queued = '$sQueued'";
if($sType)
$sSelectType = " AND type = '?'";
$sQuery = "(SELECT COUNT(DISTINCT appData.id) as count FROM appData,
appFamily, appVersion WHERE
appFamily.appId = appVersion.appId
AND
(
appData.appId = appFamily.appId
OR
)
AND
appVersion.queued = 'false'
AND
appFamily.queued = 'false'$sAppDataQueued$sSelectType) UNION
(
SELECT COUNT(DISTINCT appData.id) as count FROM appData,
appFamily, appVersion WHERE
appFamily.appId = appVersion.appId
AND
(
appData.versionId = appVersion.versionId
)
AND
appVersion.queued = 'false'
AND
appFamily.queued = 'false'";
if($sQueued == "true" || $sQueued == "false")
$sQuery .= " AND appData.queued = '$sQueued'";
appFamily.queued = 'false'$sAppDataQueued$sSelectType)";
if($sType)
{
$sQuery .= " AND type = '?'";
$hResult = query_parameters($sQuery, $sType);
} else
$hResult = query_parameters($sQuery, $sType, $sType);
else
$hResult = query_parameters($sQuery);
}
if(!$hResult)
return FALSE;
if(!$oRow = mysql_fetch_object($hResult))
return FALSE;
return $oRow->count;
for($iCount = 0; $oRow = mysql_fetch_object($hResult);)
$iCount += $oRow->count;
return $iCount;
}
function objectGetHeader($sType)