-
Notifications
You must be signed in to change notification settings - Fork 0
/
DirectoryScanner_old&unused.properties
83 lines (76 loc) · 1.58 KB
/
DirectoryScanner_old&unused.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
sql_selectDoneDirectoriesOverkill= \
SELECT d.path \
FROM directories d \
WHERE d.finished > ? \
AND d.path LIKE ? \
AND NOT EXISTS ( \
SELECT f.id \
FROM failures f \
WHERE f.path LIKE d.path || '%' \
) \
AND NOT EXISTS ( \
SELECT d2.id \
FROM directories d2 \
WHERE d2.path LIKE d.path || '%' \
AND d2.id <> d.id \
AND d2.finished > ? \
AND d2.path LIKE ? \
) \
LIMIT ?
sql_selectDoneDirectoriesOld= \
SELECT d.path \
FROM directories d \
LEFT OUTER JOIN failures f \
ON f.path LIKE d.path || '%' \
WHERE d.finished > ? \
AND d.path LIKE ? \
AND f.id IS NULL \
LIMIT ?
sql_selectDoneDirectoriesOld2= \
SELECT d.path \
FROM directories d \
WHERE d.finished > ? \
AND d.path LIKE ? \
AND NOT EXISTS ( \
SELECT f.id \
FROM failures f \
WHERE f.path LIKE d.path || '%' \
) \
ORDER BY d.path
sql_delete_old_failure_duplicatesOldExistsVersion= \
DELETE FROM failures f \
WHERE EXISTS ( \
SELECT f2.id \
FROM failures f2 \
WHERE f2.path = f.path \
AND f2.scandate > f.scandate \
)
sql_selectSha1CollisionsOld= \
SELECT \
d.path, \
d.id, \
f.filename, \
f.id, \
f.size, \
f.scandate, \
f.sha1, \
f.lastmodified \
FROM files f \
INNER JOIN directories d \
ON d.id = f.dir_id \
WHERE EXISTS ( /* same sha1 but different size */ \
SELECT ff.id \
FROM files ff \
WHERE ff.sha1 = f.sha1 \
AND ff.size <> f.size \
) \
OR EXISTS ( /* files with same name and path but different id */ \
SELECT ff2.id \
FROM files ff2 \
INNER JOIN directories dd2 \
ON dd2.id = ff2.dir_id \
WHERE ff2.id <> f.id \
AND ff2.filename = f.filename \
AND dd2.path = d.path \
) \
ORDER BY f.sha1