[ticket/12765] Use db_tools instead of generating queries at moment

https://tracker.phpbb.com/browse/PHPBB3-12765

PHPBB3-12765
Because I need to set the 2nd parameter to true (return statements instead executing).