Mercurial > dive4elements > framework
annotate artifact-database/src/main/resources/sql/org-h2-driver.properties @ 144:5369582d4fbf
Enable backend to delete users
artifacts/trunk@1369 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 02 Mar 2011 17:43:25 +0000 |
parents | 2950c6011afa |
children | db0d20440b92 |
rev | line source |
---|---|
14
0d16d1bb2df0
Initial checkin of artigact persistents back by database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 artifacts.id.nextval=SELECT NEXTVAL('ARTIFACTS_ID_SEQ') |
0d16d1bb2df0
Initial checkin of artigact persistents back by database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
0d16d1bb2df0
Initial checkin of artigact persistents back by database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 artifacts.insert=INSERT INTO artifacts \ |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
33
diff
changeset
|
4 (id, gid, creation, last_access, ttl, factory, data) \ |
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
33
diff
changeset
|
5 VALUES (?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, ?, ?, ?) |
14
0d16d1bb2df0
Initial checkin of artigact persistents back by database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
0d16d1bb2df0
Initial checkin of artigact persistents back by database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 artifacts.update=UPDATE artifacts SET last_access = CURRENT_TIMESTAMP, \ |
0d16d1bb2df0
Initial checkin of artigact persistents back by database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 data = ? WHERE id = ? |
0d16d1bb2df0
Initial checkin of artigact persistents back by database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
33
diff
changeset
|
10 artifacts.touch=UPDATE artifacts SET last_access = CURRENT_TIMESTAMP WHERE id = ? |
14
0d16d1bb2df0
Initial checkin of artigact persistents back by database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
33
diff
changeset
|
12 artifacts.outdated=SELECT id, factory, data FROM artifacts WHERE ttl IS NOT NULL \ |
43
b8516aa3d8a1
Time delta calculation in SQL statement to figure out outdated artifacts
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
41
diff
changeset
|
13 AND DATEDIFF('MILLISECOND', last_access, CURRENT_TIMESTAMP) > ttl LIMIT 50 |
14
0d16d1bb2df0
Initial checkin of artigact persistents back by database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
41
5e4bc24ea438
Made serilization more flexible. DB update required!!!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
33
diff
changeset
|
15 artifacts.select.gid=SELECT id, last_access, ttl, factory, data FROM artifacts WHERE gid = ? |
14
0d16d1bb2df0
Initial checkin of artigact persistents back by database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
80
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
17 artifacts.get.id=SELECT id FROM artifacts WHERE gid = ? |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
18 |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
19 artifacts.replace=UPDATE artifacts SET \ |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
20 creation = CURRENT_TIMESTAMP, last_access = CURRENT_TIMESTAMP, \ |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
21 ttl = ?, factory = ?, data = ? \ |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
22 WHERE id = ? |
8447467cef86
Implementation to import artifacts from incoming xml documents (applied patch from issue208 by SLT).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
43
diff
changeset
|
23 |
14
0d16d1bb2df0
Initial checkin of artigact persistents back by database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 artifacts.delete=DELETE FROM artifacts WHERE id = ? |
124
caf9f456f7e3
Added SQL statements to handle users in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
80
diff
changeset
|
25 |
caf9f456f7e3
Added SQL statements to handle users in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
80
diff
changeset
|
26 # USERS |
caf9f456f7e3
Added SQL statements to handle users in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
80
diff
changeset
|
27 |
caf9f456f7e3
Added SQL statements to handle users in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
80
diff
changeset
|
28 users.id.nextval=SELECT NEXTVAL('USERS_ID_SEQ') |
caf9f456f7e3
Added SQL statements to handle users in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
80
diff
changeset
|
29 |
caf9f456f7e3
Added SQL statements to handle users in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
80
diff
changeset
|
30 users.insert=INSERT INTO USERS (id, gid, name, role) VALUES (?, ?, ?, ?) |
caf9f456f7e3
Added SQL statements to handle users in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
80
diff
changeset
|
31 |
144
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
32 users.select.id.by.gid=SELECT id FROM users WHERE gid = ? |
124
caf9f456f7e3
Added SQL statements to handle users in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
80
diff
changeset
|
33 users.select.gid=SELECT id, name, role FROM users WHERE gid = ? |
caf9f456f7e3
Added SQL statements to handle users in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
80
diff
changeset
|
34 |
133
2950c6011afa
Fixed typo in keys.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
124
diff
changeset
|
35 users.delete.id=DELETE FROM users WHERE id = ? |
124
caf9f456f7e3
Added SQL statements to handle users in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
80
diff
changeset
|
36 |
caf9f456f7e3
Added SQL statements to handle users in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
80
diff
changeset
|
37 users.delete.collections=DELETE FROM collections where owner_id = ? |
caf9f456f7e3
Added SQL statements to handle users in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
80
diff
changeset
|
38 |
caf9f456f7e3
Added SQL statements to handle users in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
80
diff
changeset
|
39 users.select.all=SELECT id, gid, name, role FROM users |
144
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
40 |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
41 # COLLECTIONS |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
42 |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
43 delete.user.collection.items= \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
44 DELETE FROM collection_items WHERE collection_id IN \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
45 (SELECT id FROM collections WHERE owner_id = ?) |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
46 |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
47 users.collections=SELECT collection_id, gid, name FROM collections WHERE owner_id = ? |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
48 users.collection.ids=SELECT collection_id FROM collections WHERE owner_id = ? |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
49 |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
50 users.delete.all.collections=DELETE FROM collections WHERE owner_id = ? |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
51 |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
52 artifacts.in.one.collection.only=\ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
53 SELECT artifact_id FROM collection_items\ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
54 WHERE collection_id = ? AND\ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
55 artifact_id NOT IN (SELECT DISTINCT artifact_id FROM collection_items WHERE collection_id <> ?) |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
56 |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
57 outdate.artifacts.collection=UPDATE artifacts \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
58 SET last_access = DATEADD('MILLISECOND', -2, CURRENT_TIMESTAMP), ttl = 1 \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
59 WHERE id IN \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
60 SELECT artifact_id FROM collection_items \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
61 WHERE collection_id = ? AND \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
62 artifact_id NOT IN (SELECT DISTINCT artifact_id FROM collection_items WHERE collection_id <> ?)) |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
63 |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
64 outdate.artifacts.user=UPDATE artifacts \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
65 SET last_access = DATEADD('MILLISECOND', -2, CURRENT_TIMESTAMP), ttl = 1 \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
66 WHERE id IN \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
67 (SELECT artifact_id FROM collection_items WHERE \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
68 collection_id IN (SELECT id FROM collections WHERE owner_id = ?) \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
69 AND artifact_id NOT IN \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
70 (SELECT artifact_id FROM collection_items WHERE collection_id IN \ |
5369582d4fbf
Enable backend to delete users
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
133
diff
changeset
|
71 (SELECT id FROM collections WHERE owner_id <> ?))) |