Fix two issues in Query_Tool_Handler's execute_query functions:
1. mysql_query() failure path now returns immediately after
return_connection() instead of continuing to process on bad state.
2. Capture affected_rows BEFORE return_connection() to avoid race
condition. Previously, mysql_affected_rows() was called after
return_connection(), potentially accessing a stale connection.
Apply fixes to both execute_query() and execute_query_with_schema().
Addresses coderabbitai review comments.