diff artifact-database/src/main/resources/sql/org-postgresql-driver.properties @ 343:542caebea773

Add functionality to get 'oldest' artifact of a collection.' artifacts/trunk@3037 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 19 Oct 2011 15:55:33 +0000
parents 560d2e6eaf9c
children 08731e7403b5
line wrap: on
line diff
--- a/artifact-database/src/main/resources/sql/org-postgresql-driver.properties	Mon Oct 17 15:42:43 2011 +0000
+++ b/artifact-database/src/main/resources/sql/org-postgresql-driver.properties	Wed Oct 19 15:55:33 2011 +0000
@@ -128,6 +128,11 @@
 
 collection.creation.time=SELECT creation from collections WHERE id = ?
 
+collections.artifacts.oldest=SELECT a.gid, ci.artifact_id  \
+    FROM artifacts AS a, collection_items AS ci, collections AS c \
+    WHERE ci.collection_id = c.id AND c.gid = ?::uuid AND ci.artifact_id = a.id \
+    ORDER BY ci.creation
+
 collections.select.user= \
     SELECT c.gid, c.name, c.creation, u.gid, c.ttl FROM \
     collections c LEFT OUTER JOIN users u ON c.owner_id = u.id \

http://dive4elements.wald.intevation.org