Changeset - e7e6ab77c542
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2010-02-19 22:12:21
ohnobinki@ohnopublishing.net
various small mysql.c fixes
1 file changed with 9 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/server/mysql.c
Show inline comments
 
@@ -158,13 +158,14 @@ distrend_mysql_result_t mysqlQuery(distr
 

	
 
  /** make sure that connection is still alive
 
   */
 
  
 
  if(mysql_ping(conn->mysqlconn))
 
    {
 
      fprintf(stderr, "MySQL connection broken, and reconnect is disabled!\n");
 
      fprintf(stderr, "mysql_ping() failed: %s\n", mysql_error(conn->mysqlconn));
 
      return NULL;
 
    }
 

	
 
  fprintf(stderr,"Querying... ");
 
  if (mysql_query(conn->mysqlconn, query))
 
    {
 
      fprintf(stderr, "calling mysql_query() resulted in: %s\n", mysql_error(conn->mysqlconn));
 
@@ -202,12 +203,14 @@ distrend_mysql_result_t mysqlQuery(distr
 
  /**
 
     Prepare data for return.
 
   */
 
  distrenresult = malloc(sizeof(struct distrend_mysql_result));
 
  if(!distrenresult)
 
    {
 
      while(mysql_fetch_row(result))
 
	;
 
      mysql_free_result(result);
 
      return NULL;
 
    }
 

	
 
  distrenresult->mysqlresult = result;
 
  distrenresult->pointlesscheck = FORTY_TWO;
 
@@ -217,14 +220,17 @@ distrend_mysql_result_t mysqlQuery(distr
 

	
 
int mysqlResultFree(distrend_mysql_result_t result)
 
{
 
  size_t counter;
 

	
 
  if(!result)
 
    return 0;
 

	
 
    {
 
      fprintf(stderr, "mysqlResultFree(): warning, passed NULL parameter\n");
 
      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.
 
   */
0 comments (0 inline, 0 general)