Revision d57eaad4 pithos/backends/lib/sqlite/node.py

b/pithos/backends/lib/sqlite/node.py
42 42

  
43 43
( SERIAL, NODE, HASH, SIZE, TYPE, SOURCE, MTIME, MUSER, UUID, CLUSTER ) = range(10)
44 44

  
45
( MATCH_PREFIX, MATCH_EXACT ) = range(2)
46

  
45 47
inf = float('inf')
46 48

  
47 49

  
......
642 644
        if not pathq:
643 645
            return None, None
644 646
        
645
        subq = " and ("
646
        subq += ' or '.join(("n.path like ? escape '\\'" for x in pathq))
647
        subq += ")"
648
        args = tuple([self.escape_like(x) + '%' for x in pathq])
647
        subqlist = []
648
        args = []
649
        print pathq
650
        for path, match in pathq:
651
            if match == MATCH_PREFIX:
652
                subqlist.append("n.path like ? escape '\\'")
653
                args.append(self.escape_like(path) + '%')
654
            elif match == MATCH_EXACT:
655
                subqlist.append("n.path = ?")
656
                args.append(path)
657
        
658
        subq = ' and (' + ' or '.join(subqlist) + ')'
659
        args = tuple(args)
649 660
        
650 661
        return subq, args
651 662
    

Also available in: Unified diff