[aur-dev] [PATCH] pkgfuncs.inc.php: Rework query to avoid "Required by" duplicates
Packages with multiple DepConditions are returned multiple times in the "Required by" column. Limit SQL results to distinct packages. Fixes FS#32478 Signed-off-by: canyonknight <canyonknight@gmail.com> --- Ignore previous duplicates fix. This works better as an SQL fix. web/lib/pkgfuncs.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index 8f84cdf..cfdd9a7 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -169,7 +169,7 @@ function package_required($name="", $dbh=NULL) { if(!$dbh) { $dbh = db_connect(); } - $q = "SELECT p.Name, PackageID FROM PackageDepends pd "; + $q = "SELECT DISTINCT p.Name, PackageID FROM PackageDepends pd "; $q.= "JOIN Packages p ON pd.PackageID = p.ID "; $q.= "WHERE DepName = " . $dbh->quote($name) . " "; $q.= "ORDER BY p.Name"; -- 1.8.0
On Wed, Nov 14, 2012 at 05:05:53PM -0500, canyonknight wrote:
Packages with multiple DepConditions are returned multiple times in the "Required by" column.
Limit SQL results to distinct packages.
Fixes FS#32478
Signed-off-by: canyonknight <canyonknight@gmail.com> ---
Ignore previous duplicates fix. This works better as an SQL fix.
Applied, thanks!
web/lib/pkgfuncs.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index 8f84cdf..cfdd9a7 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -169,7 +169,7 @@ function package_required($name="", $dbh=NULL) { if(!$dbh) { $dbh = db_connect(); } - $q = "SELECT p.Name, PackageID FROM PackageDepends pd "; + $q = "SELECT DISTINCT p.Name, PackageID FROM PackageDepends pd "; $q.= "JOIN Packages p ON pd.PackageID = p.ID "; $q.= "WHERE DepName = " . $dbh->quote($name) . " "; $q.= "ORDER BY p.Name"; -- 1.8.0
participants (2)
-
canyonknight
-
Lukas Fleischer