Changed the way the visibility SQL statement is built.
Authored by: jplang 2011-03-15
Parent: [r5139]
Child: [r5141]