Table generator ported into a single function that takes in QueryResult; used it in AccessRightsServlet