# HG changeset patch # User Sascha L. Teichmann # Date 1299579225 0 # Node ID 949d69ad3756e5de8596687a6213ef781d9af8be # Parent dad6071c90728146abbf505c5e4929e76c30c3b0 Fixed issue with outdating an artifact if it is removed from a collection. artifacts/trunk@1423 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r dad6071c9072 -r 949d69ad3756 ChangeLog --- a/ChangeLog Tue Mar 08 09:10:55 2011 +0000 +++ b/ChangeLog Tue Mar 08 10:13:45 2011 +0000 @@ -1,3 +1,12 @@ +2011-03-08 Sascha L. Teichmann + + * artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java: + Fixed issue with outdating artifact if it is removed from a collection. + + * artifact-database/src/main/resources/sql/org-h2-driver.properties, + artifact-database/src/main/resources/sql/org-postgresql-driver.properties: + Fixed statements. + 2011-03-08 Ingo Weinzierl * artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java: diff -r dad6071c9072 -r 949d69ad3756 artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java --- a/artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java Tue Mar 08 09:10:55 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java Tue Mar 08 10:13:45 2011 +0000 @@ -1321,6 +1321,7 @@ prepareStatement(SQL_COLLECTION_ITEM_OUTDATE_ARTIFACT); stmnt.setInt(1, aid); stmnt.setInt(2, cid); + stmnt.setInt(3, cid); stmnt.execute(); reset(); diff -r dad6071c9072 -r 949d69ad3756 artifact-database/src/main/resources/sql/org-h2-driver.properties --- 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 = ? diff -r dad6071c9072 -r 949d69ad3756 artifact-database/src/main/resources/sql/org-postgresql-driver.properties --- a/artifact-database/src/main/resources/sql/org-postgresql-driver.properties Tue Mar 08 09:10:55 2011 +0000 +++ b/artifact-database/src/main/resources/sql/org-postgresql-driver.properties Tue Mar 08 10:13:45 2011 +0000 @@ -62,16 +62,17 @@ WHERE c.gid = ?::uuid AND a.gid = ?::uuid) 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 = ?::uuid AND a.gid = ?::uuid collection.item.outdate.artifact= \ UPDATE artifacts \ SET last_access = CURRENT_TIMESTAMP - '2 microseconds'::interval, 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 = ?