I tried. I traced the control flow in mysql connector. But I still don't understand know why I need to call it twice. There are no asynchronous calls inside the connector. On the first time it's called it will set one flag from 1 to 0, and the second time, because of that, the program will fall onto a different if-else branch. On the first time it's executed it would call mysql_stmt_get_results(); and the second time it would call mysql_get_results() instead. But according to the spec the second call should be identical to the first.

In short, I don't understand why.