Speedup appData::objectGetEntries()

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-05-28 21:44:14 +00:00
committed by WineHQ
parent 9ad365e1bd
commit 5d030f8b2d

View File

@@ -332,13 +332,30 @@ class appData
} }
} else } else
{ {
$sQuery = "SELECT DISTINCT appData.* FROM appData, appFamily, appVersion if($iStart || $iRows)
WHERE $sLimit = " LIMIT ?,?";
appVersion.appId = appFamily.appId
$sQuery = "(SELECT DISTINCT appData.* FROM appData,
appFamily, appVersion WHERE
appFamily.appId = appVersion.appId
AND AND
( (
appData.appId = appFamily.appId appData.appId = appFamily.appId
OR )
AND
appVersion.queued = 'false'
AND
appFamily.queued = 'false'
AND
appData.queued = '?'
AND
appData.type = '?'$sLimit) UNION
(
SELECT DISTINCT appData.* FROM appData,
appFamily, appVersion WHERE
appFamily.appId = appVersion.appId
AND
(
appData.versionId = appVersion.versionId appData.versionId = appVersion.versionId
) )
AND AND
@@ -348,17 +365,19 @@ class appData
AND AND
appData.queued = '?' appData.queued = '?'
AND AND
appData.type = '?'"; appData.type = '?'$sLimit)";
if(!$iRows && !$iStart) if(!$iRows && !$iStart)
{ {
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType); $hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType,
$bQueued ? "true" : "false", $sType);
} else } else
{ {
if(!$iRows) if(!$iRows)
$iRows = appData::objectGetEntriesCount($bQueued ? "true" : "false", $iRows = appData::objectGetEntriesCount($bQueued ? "true" : "false",
$bRejected, $sType); $bRejected, $sType);
$sQuery .= " LIMIT ?,?";
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType, $hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType,
$iStart, $iRows,
$bQueued ? "true" : "false", $sType,
$iStart, $iRows); $iStart, $iRows);
} }
} }