[svn r524] Fixed error when reconnecting gmyth_query trunk
authormelunko
Wed Apr 11 18:12:09 2007 +0100 (2007-04-11)
branchtrunk
changeset 519ea6b3247eb59
parent 518 4ff7cb1a27d2
child 520 92acf23b87f0
[svn r524] Fixed error when reconnecting gmyth_query
gmyth/src/gmyth_query.c
     1.1 --- a/gmyth/src/gmyth_query.c	Tue Apr 10 23:24:53 2007 +0100
     1.2 +++ b/gmyth/src/gmyth_query.c	Wed Apr 11 18:12:09 2007 +0100
     1.3 @@ -108,7 +108,10 @@
     1.4  		GMythBackendInfo *backend_info, guint timeout)
     1.5  {
     1.6      assert(gmyth_query);    
     1.7 -    g_return_val_if_fail (gmyth_query->conn != NULL, FALSE);
     1.8 +
     1.9 +    if (gmyth_query->conn == NULL) {
    1.10 +	gmyth_query->conn = mysql_init (NULL);
    1.11 +    }
    1.12  
    1.13      if (timeout != 0) {
    1.14          /* sets connection timeout */
    1.15 @@ -139,8 +142,7 @@
    1.16      gmyth_query->backend_info = backend_info;
    1.17  
    1.18      if (gmyth_query->conn == NULL) {
    1.19 -        gmyth_query_print_error (NULL, "mysql_init() failed (probably out of memory)");
    1.20 -        return FALSE;
    1.21 +	gmyth_query->conn = mysql_init (NULL);
    1.22      }
    1.23      
    1.24      /* connect to server */
    1.25 @@ -148,7 +150,7 @@
    1.26                      	    gmyth_query->backend_info->hostname, 
    1.27                              gmyth_query->backend_info->username,
    1.28              	            gmyth_query->backend_info->password,
    1.29 -        	                gmyth_query->backend_info->db_name, 
    1.30 +        	            gmyth_query->backend_info->db_name, 
    1.31                              0, NULL, 0) == NULL) {            	
    1.32          gmyth_query_print_error (gmyth_query->conn, "mysql_real_connect() failed");
    1.33  		return FALSE;
    1.34 @@ -178,8 +180,9 @@
    1.35      gmyth_debug ("[%s] Closing gmyth_query->conn", __FUNCTION__);
    1.36  
    1.37      mysql_close (gmyth_query->conn);
    1.38 +    gmyth_query->conn = NULL;
    1.39  
    1.40 -	return TRUE;	
    1.41 +    return TRUE;	
    1.42  }
    1.43  
    1.44  static void