blob: 6be8298d63097d12e1a033d5e4101c8f257ae402 (
plain)
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
|
<?xml version="1.0"?>
<packageimport name="bugassociate" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:project2="http://project2.randomdan.homeip.net">
<project2:sqlrows name="fileTypes" datasource="postgres">
<sql>
SELECT filetypeid, searchroot, searchspec
FROM filetypes
ORDER BY filetypeid DESC
</sql>
</project2:sqlrows>
<project2:fsrows name="findCacheFiles" />
<project2:sqlmerge name="files" datasource="postgres" targettable="files">
<project2:iterate name="eachFileType" source="fileTypes">
<project2:iterate name="eachCacheFile" source="findCacheFiles">
<parameters>
<param name="root"><value source="parent" name="searchroot" depth="1" /></param>
<param name="spec"><value source="parent" name="searchspec" depth="1" /></param>
</parameters>
<project2:sqlmergeinsert name="insertFile">
<parameters>
<param name="filename"><value source="parent" attribute="relPath" depth="1" /></param>
<param name="moddate"><value source="parent" attribute="modifiedDate" depth="1"/></param>
<param name="filetypeid"><value source="parent" name="filetypeid" depth="2" /></param>
</parameters>
</project2:sqlmergeinsert>
</project2:iterate>
</project2:iterate>
<columns>
<column key="true">filename</column>
<column>moddate</column>
<column>filetypeid</column>
</columns>
</project2:sqlmerge>
<project2:sqlrows name="outDatedFiles" datasource="postgres">
<sql>
SELECT f.fileid, ft.searchroot || f.filename AS filename, f.cachedat, f.moddate
FROM files f, filetypes ft
WHERE (f.cachedat IS NULL OR f.cachedat != f.moddate)
AND f.filetypeid = ft.filetypeid
ORDER BY f.fileid
</sql>
</project2:sqlrows>
<project2:filerows name="readFileContent" newline=" " encoding="utf-8" fieldSep="" quoteChar="" keepBlankRows="count" >
<path source="parent" name="filename" depth="1" />
<columns>
<column>content</column>
</columns>
</project2:filerows>
<project2:sqlmerge name="loadCacheContent" datasource="postgres" targettable="filecache"
updatewhere="a.fileid IN (SELECT o.fileid FROM files o WHERE o.cachedat IS NULL OR o.cachedat != o.moddate)">
<project2:iterate name="eachOutDatedFile" source="outDatedFiles">
<project2:iterate name="eachFileContent" source="readFileContent">
<project2:sqlmergeinsert name="insertFile">
<parameters>
<param name="fileid"><value source="parent" name="fileid" depth="2" /></param>
<param name="line"><value source="parent" attribute="rownum" depth="1" /></param>
<param name="content"><value source="parent" name="content" depth="1" /></param>
</parameters>
</project2:sqlmergeinsert>
</project2:iterate>
</project2:iterate>
<columns>
<column key="true">fileid</column>
<column key="true">line</column>
<column>content</column>
</columns>
</project2:sqlmerge>
<project2:sqltask name="setCachedTime" datasource="postgres">
<sql>UPDATE files SET cachedat = moddate WHERE cachedat != moddate OR cachedat IS NULL</sql>
</project2:sqltask>
</packageimport>
|