commit-womb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-womb] gnumaint/fsd gnufsd-psql


From: Kaloian Doganov
Subject: [commit-womb] gnumaint/fsd gnufsd-psql
Date: Sat, 06 Jun 2009 17:14:47 +0000

CVSROOT:        /sources/womb
Module name:    gnumaint
Changes by:     Kaloian Doganov <kaloian>       09/06/06 17:14:47

Modified files:
        fsd            : gnufsd-psql 

Log message:
        Added support for directory keywords.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnumaint/fsd/gnufsd-psql?cvsroot=womb&r1=1.9&r2=1.10

Patches:
Index: gnufsd-psql
===================================================================
RCS file: /sources/womb/gnumaint/fsd/gnufsd-psql,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- gnufsd-psql 6 Jun 2009 15:10:27 -0000       1.9
+++ gnufsd-psql 6 Jun 2009 17:14:47 -0000       1.10
@@ -1,5 +1,5 @@
 #!/usr/bin/env perl
-# $Id: gnufsd-psql,v 1.9 2009/06/06 15:10:27 kaloian Exp $
+# $Id: gnufsd-psql,v 1.10 2009/06/06 17:14:47 kaloian Exp $
 # Extract information about GNU packages from the Free Software
 # Directory's PostgreSQL database.
 #
@@ -31,8 +31,8 @@
 
 my ($dbh, $sth_homepage, $sth_download_url, $sth_activity_status,
     $sth_computer_languages, $sth_subprograms, $sth_categories,
-    $sth_category, $sth_related, $sth_versions, $sth_licenses,
-    $sth_interfaces);
+    $sth_category, $sth_keywords, $sth_related, $sth_versions,
+    $sth_licenses, $sth_interfaces);
 
 my %user_level_enum = (
   0 => "unknown",
@@ -95,6 +95,12 @@
     "SELECT name, slug, parent_category_id  FROM directory_category
      WHERE id = ?;");
 
+  $sth_keywords = $dbh->prepare (
+    "SELECT k.keyword
+     FROM directory_keyword k, directory_project_keywords p
+     WHERE p.keyword_id = k.id AND p.project_id = ?
+     ORDER BY k.keyword ASC;");
+
   $sth_related = $dbh->prepare (
     "SELECT p.slug
      FROM directory_project p, directory_project_related r
@@ -351,6 +357,17 @@
 }
 
 # Fetch related projects for a project.
+sub keywords (\%)
+{
+  my ($project) = @_;
+  my $id = $project->{"id"};
+  $sth_keywords->bind_param (1, $id);
+  my @keywords = all_col ($sth_keywords, "keyword");
+
+  return @keywords;
+}
+
+# Fetch related projects for a project.
 sub related (\%)
 {
   my ($project) = @_;
@@ -507,6 +524,9 @@
 
   print "category: $_\n" foreach (categories (%$project));
 
+  my $keywords = join (" | ", keywords (%$project));
+  print "keywords: $keywords\n" if ! ($keywords eq '');
+
   my $related = join (" | ", related (%$project));
   print "related-packages: $related\n" if ! ($related eq '');
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]