• kostja@bodhi.local's avatar
    A fix and a test case for Bug#15752 "Lost connection to MySQL server · 2ce1a07c
    kostja@bodhi.local authored
    when calling a SP from C API"
    
    The bug was caused by lack of checks for misuse in mysql_real_query. 
    A stored procedure always returns at least one result, which is the 
    status of execution of the procedure itself.
    This result, or so-called OK packet, is similar to a result
    returned by INSERT/UPDATE/CREATE operations: it contains the overall
    status of execution, the number of affected rows and the number of
    warnings. The client test program attached to the bug did not read this 
    result and ivnoked the next query. In turn, libmysql had no check for 
    such scenario and mysql_real_query was simply trying to send that query 
    without reading the pending response, thus messing up the communication
    protocol.
    
    The fix is to return an error from mysql_real_query when it's called
    prior to retrieval of all pending results.
    2ce1a07c
client.c 87.9 KB