Fix dry run sql output.

Prevent aborting loop too early, therefore outputting all sql instead of 
just the first query.