ChangeSet ID: 31145 CVSROOT: /opt/cvs-commit Module name: appdb Changes by: wineowner@winehq.org 2007/05/28 16:44:14
Modified files: include : appData.php
Log message: Alexander Nicolaysen Sørnes alex@thehandofagony.com Speedup appData::objectGetEntries()
Patch: http://cvs.winehq.org/patch.py?id=31145
Old revision New revision Changes Path 1.19 1.20 +26 -7 appdb/include/appData.php
Index: appdb/include/appData.php diff -u -p appdb/include/appData.php:1.19 appdb/include/appData.php:1.20 --- appdb/include/appData.php:1.19 28 May 2007 21:44:14 -0000 +++ appdb/include/appData.php 28 May 2007 21:44:14 -0000 @@ -332,13 +332,30 @@ class appData } } else { - $sQuery = "SELECT DISTINCT appData.* FROM appData, appFamily, appVersion - WHERE - appVersion.appId = appFamily.appId + if($iStart || $iRows) + $sLimit = " LIMIT ?,?"; + + $sQuery = "(SELECT DISTINCT appData.* FROM appData, + appFamily, appVersion WHERE + appFamily.appId = appVersion.appId AND ( 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 ) AND @@ -348,17 +365,19 @@ class appData AND appData.queued = '?' AND - appData.type = '?'"; + appData.type = '?'$sLimit)"; if(!$iRows && !$iStart) { - $hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType); + $hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType, + $bQueued ? "true" : "false", $sType); } else { if(!$iRows) $iRows = appData::objectGetEntriesCount($bQueued ? "true" : "false", $bRejected, $sType); - $sQuery .= " LIMIT ?,?"; $hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType, + $iStart, $iRows, + $bQueued ? "true" : "false", $sType, $iStart, $iRows); } }