diff options
author | 2010-01-02 19:22:41 +0000 | |
---|---|---|
committer | 2010-01-02 19:22:41 +0000 | |
commit | 6ca9e7a09fc91bec2ef4f124d21704ba03a579d4 (patch) | |
tree | 66152a84c96d13d54d439ba350e1aac1c19722fd | |
parent | cosmetics and optimization (diff) | |
download | znurt-org-backend-6ca9e7a09fc91bec2ef4f124d21704ba03a579d4.tar.gz znurt-org-backend-6ca9e7a09fc91bec2ef4f124d21704ba03a579d4.tar.bz2 znurt-org-backend-6ca9e7a09fc91bec2ef4f124d21704ba03a579d4.zip |
new function, package_description
git-svn-id: file:///var/svn/portage@42 3218660a-b0cf-4799-a991-8ddcc5b9e0f3
-rw-r--r-- | functions.sql | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/functions.sql b/functions.sql index 176906b..8bfbda6 100644 --- a/functions.sql +++ b/functions.sql @@ -50,4 +50,13 @@ END IF; package_name := regexp_replace(package_name, E'-\\d+((\.\\d+)+)?([a-z])?((_(alpha|beta|pre|rc|p)\\d*)+)?(-r\\d+)?(:.+)?([.+])?$', ''); END; +$$ language plpgsql; + + +CREATE OR REPLACE FUNCTION package_description(package_id int, OUT package_description text) AS $$ +BEGIN + +package_description := em.value FROM ebuild e INNER JOIN package p ON e.package = p.id AND e.package = package_id INNER JOIN ebuild_metadata em ON em.ebuild = e.id AND em.keyword::text = 'description'::text WHERE e.id = (( SELECT e2.id FROM ebuild e2 WHERE e2.package = package_id ORDER BY e2.cache_mtime DESC, e2.ev DESC, e2.lvl DESC, e2.p IS NULL, e2.p DESC, e2.rc IS NULL, e2.rc DESC, e2.pre IS NULL, e2.pre DESC, e2.beta IS NULL, e2.beta DESC, e2.alpha IS NULL, e2.alpha DESC, e2.pr IS NULL, e2.pr DESC LIMIT 1)); + +END; $$ language plpgsql;
\ No newline at end of file |