searchfolders.txt 752 B

123456789101112131415161718192021222324252627
  1. # Count children of FINDER_ROOTs without using PR_SUBFOLDERS
  2. #
  3. SELECT COUNT(*)
  4. FROM properties AS p
  5. INNER JOIN hierarchy AS hp ON p.hierarchyid=hp.id AND p.tag=0x3001
  6. INNER JOIN hierarchy AS hc ON hp.id=hc.parent
  7. WHERE p.val_string="FINDER_ROOT";
  8. # Uses PR_SUBFOLDERS hack to count
  9. # (It's an integer rather than a boolean in the KC DB)
  10. #
  11. SELECT SUM(p2.val_ulong)
  12. FROM properties AS p1
  13. INNER JOIN properties AS p2
  14. ON p1.hierarchyid=p2.hierarchyid AND p1.tag=0x3001 AND p2.tag=0x360A
  15. WHERE p1.val_string="FINDER_ROOT";
  16. # Show distribution
  17. #
  18. SELECT p2.val_ulong
  19. FROM properties AS p1
  20. INNER JOIN properties AS p2
  21. ON p1.hierarchyid=p2.hierarchyid AND p1.tag=0x3001 AND p2.tag=0x360A
  22. WHERE p1.val_string="FINDER_ROOT"
  23. ORDER BY p2.val_ulong DESC
  24. LIMIT 25;