comparison artifact-database/src/main/resources/sql/org-h2-driver.properties @ 274:92166f7c3842

#50 Added code on database level to recognize the oldest collection item in a collection (-> master artifact). artifacts/trunk@2071 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 07 Jun 2011 17:09:25 +0000
parents 22a90706d32d
children e92d5944fe4b
comparison
equal deleted inserted replaced
273:22a90706d32d 274:92166f7c3842
49 49
50 # COLLECTION ITEMS 50 # COLLECTION ITEMS
51 collection.items.id.nextval=SELECT NEXTVAL('COLLECTION_ITEMS_ID_SEQ') 51 collection.items.id.nextval=SELECT NEXTVAL('COLLECTION_ITEMS_ID_SEQ')
52 52
53 collection.items.insert=INSERT INTO collection_items \ 53 collection.items.insert=INSERT INTO collection_items \
54 (id, collection_id, artifact_id, attribute) \ 54 (id, collection_id, artifact_id, attribute, creation) \
55 VALUES (?, ?, ?, ?) 55 VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP)
56 56
57 collection.item.get.attribute= \ 57 collection.item.get.attribute= \
58 SELECT ci.attribute FROM collection_items ci \ 58 SELECT ci.attribute FROM collection_items ci \
59 INNER JOIN collections c ON ci.collection_id = c.id \ 59 INNER JOIN collections c ON ci.collection_id = c.id \
60 INNER JOIN artifacts a ON ci.artifact_id = a.id \ 60 INNER JOIN artifacts a ON ci.artifact_id = a.id \
83 collection.item.delete=DELETE FROM collection_items WHERE id = ? 83 collection.item.delete=DELETE FROM collection_items WHERE id = ?
84 84
85 collection.items.list.gid= \ 85 collection.items.list.gid= \
86 SELECT a.gid, ci.attribute FROM collection_items ci \ 86 SELECT a.gid, ci.attribute FROM collection_items ci \
87 INNER JOIN artifacts a ON ci.artifact_id = a.id \ 87 INNER JOIN artifacts a ON ci.artifact_id = a.id \
88 WHERE ci.collection_id IN (SELECT id FROM collections WHERE gid = ?) 88 WHERE ci.collection_id IN (SELECT id FROM collections WHERE gid = ?) \
89 ORDER BY ci.creation
89 90
90 # COLLECTIONS 91 # COLLECTIONS
91 92
92 collections.outdated= \ 93 collections.outdated= \
93 SELECT c.id FROM collections c \ 94 SELECT c.id FROM collections c \

http://dive4elements.wald.intevation.org