diff artifact-database/src/main/resources/sql/org-h2-driver.properties @ 180:38fbbeffe8fe

Added code to remove an artifact from a collection artifacts/trunk@1406 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 06 Mar 2011 11:49:00 +0000
parents 644fd11ddd9f
children 116482169b44
line wrap: on
line diff
--- a/artifact-database/src/main/resources/sql/org-h2-driver.properties	Sun Mar 06 10:55:37 2011 +0000
+++ b/artifact-database/src/main/resources/sql/org-h2-driver.properties	Sun Mar 06 11:49:00 2011 +0000
@@ -61,11 +61,29 @@
             INNER JOIN attributes a ON ci.artifact_id = a.id \
             WHERE c.gid = ? AND a.gid = ?)
 
+collection.item.id.cid.aid= \
+    SELECT ci.id, c.collection_id, c.artifact_id FROM collections_items ci \
+        INNER JOIN collection c ON ci.collection_id = c.id \
+        INNER JOIN attributes a ON ci.artifact_id = a.id \
+        WHERE c.gid = ? AND a.gid = ?
+
+collection.item.outdate.artifact= \
+    UPDATE artifacts \
+    SET last_access = DATEADD('MILLISECOND', -2, CURRENT_TIMESTAMP), ttl = 1 \
+    WHERE id = ? AND \
+    NOT EXSITS (SELECT id FROM collections_items WHERE <> collection_id = ?)
+
+collection.item.delete=DELETE FROM collections_items WHERE id = ?
+
 # COLLECTIONS
 collections.touch.by.gid =\
     UPDATE collection SET last_access = CURRENT_TIMESTAMP \
         WHERE gid = ?
 
+collections.touch.by.id =\
+    UPDATE collection SET last_access = CURRENT_TIMESTAMP \
+        WHERE id = ?
+
 collections.id.nextval=SELECT NEXTVAL('COLLECTIONS_ID_SEQ')
 
 collections.id.by.gid=SELECT id FROM collections WHERE gid = ?

http://dive4elements.wald.intevation.org