#764418 by David_Rothstein, jpmckinney, quiptime, Crell: Move query conditional helper functions to database.inc to avoid fatal errors in lower bootstrap levels.