
The `MYSQL_ROW row` variable was being overwritten by the extra query done by the SST method detection code. Moving it into its own function prevents this and makes the code significantly easier to comprehend. Added a test case that reproduced the problem (MaxScale crashed) and verifies that the patch fixes the problem.