Project

General

Profile

Bug #2155 » soil-query3a.sql

Matt Jones, 09/28/2006 08:51 AM

 
1
SELECT docid,docname,doctype,date_created, date_updated, rev 
2
  FROM xml_documents 
3
 WHERE docid IN (
4
                 (
5
                  SELECT DISTINCT docid FROM xml_path_index 
6
                   WHERE UPPER(nodedata) = '%SOIL%' 
7
                     AND path IN ('abstract/para','givenName','keyword','organizationName','title','surName',
8
                                  'para','geographicDescription','literalLayout'
9
                                 )
10
                 )
11
                )  
12
   AND ( 
13
        docid IN (SELECT docid FROM xml_documents WHERE lower(user_owner) ='public') 
14
              OR (docid IN 
15
                           (
16
                                      SELECT docid from xml_access 
17
                                       WHERE (
18
                                                (
19
                                                 lower(principal_name) = 'public' 
20
                                                 AND perm_type = 'allow' 
21
                                                 AND (permission='4' OR permission='5' OR permission='6' OR permission='7')
22
                                                )
23
                                                OR 
24
                                                (
25
                                                     lower(principal_name) = 'public' 
26
                                                     AND perm_type = 'allow' 
27
                                                     AND (permission='4' OR permission='5' OR permission='6' OR permission='7')
28
                                                )
29
                                             ) 
30
                                         AND subtreeid IS NULL
31
                           ) 
32
                  AND docid NOT IN (
33
                                      SELECT docid from xml_access 
34
                                       WHERE (
35
                                                (
36
                                                   lower(principal_name) = 'public' 
37
                                                   AND perm_type = 'deny' 
38
                                                   AND perm_order ='allowFirst' 
39
                                                   AND (permission='4' OR permission='5' OR permission='6' OR permission='7')
40
                                                )
41
                                                OR 
42
                                                (
43
                                                   lower(principal_name) = 'public' 
44
                                                   AND perm_type = 'deny' 
45
                                                   AND perm_order ='allowFirst' 
46
                                                   AND (permission='4' OR permission='5' OR permission='6' OR permission='7')
47
                                                )
48
                                             ) 
49
                                         AND subtreeid IS NULL 
50
                                   )
51
                 )
52
       ) 
(3-3/34)