diff artifact-database/src/main/resources/sql/org-h2-driver.properties @ 193:949d69ad3756

Fixed issue with outdating an artifact if it is removed from a collection. artifacts/trunk@1423 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 08 Mar 2011 10:13:45 +0000
parents 3bce5556a2e5
children 63f555bbdbc0
line wrap: on
line diff
--- a/artifact-database/src/main/resources/sql/org-h2-driver.properties	Tue Mar 08 09:10:55 2011 +0000
+++ b/artifact-database/src/main/resources/sql/org-h2-driver.properties	Tue Mar 08 10:13:45 2011 +0000
@@ -62,16 +62,17 @@
             WHERE c.gid = ? AND a.gid = ?)
 
 collection.item.id.cid.aid= \
-    SELECT ci.id, c.collection_id, c.artifact_id FROM collection_items ci \
-        INNER JOIN collection c ON ci.collection_id = c.id \
-        INNER JOIN attributes a ON ci.artifact_id = a.id \
+    SELECT ci.id, ci.collection_id, ci.artifact_id FROM collection_items ci \
+        INNER JOIN collections c ON ci.collection_id = c.id \
+        INNER JOIN artifacts 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 collection_items WHERE <> collection_id = ?)
+    NOT EXSITS \
+    (SELECT id FROM collection_items WHERE collection_id <> ? AND artifact_id = ?)
 
 collection.item.delete=DELETE FROM collection_items WHERE id = ?
 

http://dive4elements.wald.intevation.org