[ticket/12687] Return a string and move the displaying of the sql report

PHPBB3-12687