node js db-mysql commands out of sync


While attempting to execute a stored procedure I'm occasionally getting the "Commands out of sync; you can't run this command now" error.

It is my understanding that the problem is caused by me not cleaning up the additional result set being returned by the stored proc before attempting to call the procedure again.

I've seen solutions online (,140863,179132#msg-179132):

while (mysqli_more_results($dbc)) { 
    if (mysqli_next_result($dbc)) { 
        $result = mysqli_use_result($dbc); 

But I'm unsure how to work around this issue in db-mysql.

Any advice would be greatly appreciated.

Problem courtesy of: jckdnk111


I wasn't able to find a workaround so I wrote a patch.

Solution courtesy of: jckdnk111


There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.