This is a follow-up from https://reviews.llvm.org/D43862, to cover other function the were executing the same code and adding test coverage for the existing functionality.
Original message by Przemek Wirkus:
This patch is response to issue with LNT WebUI "Error accessing URL /db_default/v4/nts/profile/ajax/getFunctions; NOT FOUND". This issue appears in certain circumstances when user access Web UI under LNT / nts / profile.
Modified by this patch session query may fetch row(s) with profile_id values set to NULL. In order to fetch only not NULL values this patch modifies way we query DB. Query rows with profile_id set to NULL are not desired when query for LNT/nts/profile data.
Note that session query limits it's search to first element of the query which may have profile_id set to NULL (if entry of this type was imported to LNT database before any entry with profile data).