1#
2# for .bvfs_lsdir
3#
4# Retrieve special directors "." and "..".
5# If attributes of this paths are known, include them,
6# otherwise result for extra columns will be empty.
7#
8# parameter:
9#   %s PathId
10#   %s PathId
11#   %s JobIds ("1,2,...")
12#
13# row  0    1                  2                3      4      5
14SELECT 'D', SpecialDir.PathId, SpecialDir.Path, JobId, LStat, FileId
15FROM (
16    SELECT %s AS PathId, '.' AS Path
17
18    UNION
19
20    SELECT PPathId AS PathId, '..' AS Path
21    FROM   PathHierarchy
22    WHERE  PathId = %s
23) AS SpecialDir
24LEFT JOIN (
25    SELECT PathId, JobId, LStat, FileId
26    FROM File
27    WHERE File.Name = ''
28      AND File.JobId IN (%s)
29) AS DirAttribute
30ON (SpecialDir.PathId = DirAttribute.PathId)
31