Authors: Alexander Nicolaysen Sørnes <alex@thehandofagony.com>, Chris Morgan <cmorgan@alum.wpi.edu>

Fix queued maintainer sql with missing join causing millions of rows to be generated by a
relatively simple sql statement
This commit is contained in:
WineHQ
2007-03-11 20:39:02 +00:00
parent 9bba0ecd65
commit 43ac9708ca
2 changed files with 24 additions and 10 deletions

View File

@@ -270,19 +270,33 @@ class maintainer
return $aAppsMaintained;
}
function getQueuedMaintainerCount()
function objectGetEntriesCount($bQueued)
{
/* Excluding requests for queued apps and versions, as these are handled
automatically. One SELECT for super maintainers, one for maintainers. */
$sQuery = "SELECT COUNT(DISTINCT maintainerId) as queued_maintainers FROM
appMaintainers, appFamily, appVersion
WHERE appMaintainers.queued='true' AND ((appFamily.appId =
appMaintainers.appId AND appFamily.queued = 'false' AND
appMaintainers.versionId = '') OR (
appVersion.versionId = appMaintainers.versionId
AND appVersion.queued = 'false'))";
$sQuery = "SELECT COUNT(DISTINCT maintainerId) as queued_maintainers FROM
appMaintainers, appFamily, appVersion WHERE
appMaintainers.queued = '?'
AND
appFamily.appId = appVersion.appId
AND
(
(
appFamily.appId = appMaintainers.appId
AND
appFamily.queued = 'false'
AND
appMaintainers.versionId = ''
)
OR
(
appVersion.versionId = appMaintainers.versionId
AND
appVersion.queued = 'false'
)
)";
if(!($hResult = query_parameters($sQuery)))
if(!($hResult = query_parameters($sQuery, $bQueued ? "true" : "false")))
return FALSE;
$oRow = mysql_fetch_object($hResult);