version: Simplify SQL code
This commit is contained in:
committed by
Chris Morgan
parent
d05ee436f5
commit
489698c29f
@@ -1360,34 +1360,16 @@ class version {
|
|||||||
not be able to see rejected entries for versions they maintain */
|
not be able to see rejected entries for versions they maintain */
|
||||||
if($bRejected)
|
if($bRejected)
|
||||||
$sQuery = "SELECT COUNT(DISTINCT appVersion.versionId) as count FROM
|
$sQuery = "SELECT COUNT(DISTINCT appVersion.versionId) as count FROM
|
||||||
appVersion, appFamily WHERE
|
appVersion WHERE
|
||||||
appFamily.appId = appVersion.appId
|
|
||||||
AND
|
|
||||||
appFamily.queued = 'false'
|
|
||||||
AND
|
|
||||||
appVersion.submitterId = '?'
|
appVersion.submitterId = '?'
|
||||||
AND
|
AND
|
||||||
appVersion.queued = '?'";
|
appVersion.queued = '?'";
|
||||||
else
|
else
|
||||||
$sQuery = "SELECT COUNT(DISTINCT appVersion.versionId) as count FROM
|
$sQuery = "SELECT COUNT(DISTINCT appVersion.versionId) as count FROM
|
||||||
appVersion, appMaintainers, appFamily WHERE
|
appVersion, appMaintainers WHERE
|
||||||
appFamily.appId = appVersion.appId
|
|
||||||
AND
|
|
||||||
appFamily.queued = 'false'
|
|
||||||
AND
|
|
||||||
(
|
|
||||||
(
|
|
||||||
appMaintainers.appId = appVersion.appId
|
appMaintainers.appId = appVersion.appId
|
||||||
AND
|
AND
|
||||||
superMaintainer = '1'
|
superMaintainer = '1'
|
||||||
)
|
|
||||||
OR
|
|
||||||
(
|
|
||||||
appMaintainers.versionId = appVersion.versionId
|
|
||||||
AND
|
|
||||||
superMaintainer = '0'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
AND
|
AND
|
||||||
appMaintainers.userId = '?'
|
appMaintainers.userId = '?'
|
||||||
AND
|
AND
|
||||||
@@ -1399,11 +1381,7 @@ class version {
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT COUNT(DISTINCT versionId) as count
|
$sQuery = "SELECT COUNT(DISTINCT versionId) as count
|
||||||
FROM appVersion, appFamily WHERE
|
FROM appVersion WHERE
|
||||||
appFamily.appId = appVersion.appId
|
|
||||||
AND
|
|
||||||
appFamily.queued = 'false'
|
|
||||||
AND
|
|
||||||
appVersion.queued = '?'";
|
appVersion.queued = '?'";
|
||||||
$hResult = query_parameters($sQuery, $sQueued);
|
$hResult = query_parameters($sQuery, $sQueued);
|
||||||
}
|
}
|
||||||
@@ -1508,35 +1486,16 @@ class version {
|
|||||||
/* Users should see their own rejected entries, but maintainers should
|
/* Users should see their own rejected entries, but maintainers should
|
||||||
not be able to see rejected entries for versions they maintain */
|
not be able to see rejected entries for versions they maintain */
|
||||||
if($bRejected)
|
if($bRejected)
|
||||||
$sQuery = "SELECT appVersion.* FROM
|
$sQuery = "SELECT * FROM appVersion WHERE
|
||||||
appVersion, appFamily WHERE
|
|
||||||
appFamily.appId = appVersion.appId
|
|
||||||
AND
|
|
||||||
appFamily.queued = 'false'
|
|
||||||
AND
|
|
||||||
appVersion.submitterId = '?'
|
appVersion.submitterId = '?'
|
||||||
AND
|
AND
|
||||||
appVersion.queued = '?' ORDER BY ?$sLimit";
|
appVersion.queued = '?' ORDER BY ?$sLimit";
|
||||||
else
|
else
|
||||||
$sQuery = "SELECT appVersion.* FROM
|
$sQuery = "SELECT appVersion.* FROM
|
||||||
appVersion, appMaintainers, appFamily WHERE
|
appVersion, appMaintainers WHERE
|
||||||
appFamily.appId = appVersion.appId
|
|
||||||
AND
|
|
||||||
appFamily.queued = 'false'
|
|
||||||
AND
|
|
||||||
(
|
|
||||||
(
|
|
||||||
appMaintainers.appId = appVersion.appId
|
appMaintainers.appId = appVersion.appId
|
||||||
AND
|
and
|
||||||
superMaintainer = '1'
|
superMaintainer = '1'
|
||||||
)
|
|
||||||
OR
|
|
||||||
(
|
|
||||||
appMaintainers.versionId = appVersion.versionId
|
|
||||||
AND
|
|
||||||
superMaintainer = '0'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
AND
|
AND
|
||||||
appMaintainers.userId = '?'
|
appMaintainers.userId = '?'
|
||||||
AND
|
AND
|
||||||
@@ -1555,12 +1514,7 @@ class version {
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT appVersion.*
|
$sQuery = "SELECT * FROM appVersion WHERE
|
||||||
FROM appVersion, appFamily WHERE
|
|
||||||
appFamily.appId = appVersion.appId
|
|
||||||
AND
|
|
||||||
appFamily.queued = 'false'
|
|
||||||
AND
|
|
||||||
appVersion.queued = '?' ORDER BY ?$sLimit";
|
appVersion.queued = '?' ORDER BY ?$sLimit";
|
||||||
|
|
||||||
if($sLimit)
|
if($sLimit)
|
||||||
|
|||||||
Reference in New Issue
Block a user