Changeset - 489f33eeccf4
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2010-02-18 21:46:11
ohnobinki@ohnopublishing.net
Add code to flush mysql result before calling mysql_free_result()
1 file changed with 12 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/server/mysql.c
Show inline comments
 
@@ -177,12 +177,24 @@ distrend_mysql_result_t mysqlQuery(distr
 

	
 
int mysqlResultFree(distrend_mysql_result_t result)
 
{
 
  size_t counter;
 

	
 
  if(!result)
 
    return 0;
 

	
 
  if(result->pointlesscheck != FORTY_TWO)
 
    fprintf(stderr, "%s:%d: I didn't get the type of handle I wanted\n", __FILE__, __LINE__);
 

	
 
  /**
 
     Must flush the resultset buffer.
 
   */
 
  for(counter = 0;
 
      mysql_fetch_row(result->mysqlresult);
 
      counter ++)
 
    ;
 
  if(counter)
 
    fprintf(stderr, "Calling function did not flush all of the rows it should've\n");
 

	
 
  mysql_free_result(result->mysqlresult);
 
  free(result);
 

	
0 comments (0 inline, 0 general)