# HG changeset patch # User melunko # Date 1176311529 -3600 # Node ID ea6b3247eb59da46119ad90ba2450ba7bee5f70e # Parent 4ff7cb1a27d2888322a56cf2dfbac8db2a27abf4 [svn r524] Fixed error when reconnecting gmyth_query diff -r 4ff7cb1a27d2 -r ea6b3247eb59 gmyth/src/gmyth_query.c --- a/gmyth/src/gmyth_query.c Tue Apr 10 23:24:53 2007 +0100 +++ b/gmyth/src/gmyth_query.c Wed Apr 11 18:12:09 2007 +0100 @@ -108,7 +108,10 @@ GMythBackendInfo *backend_info, guint timeout) { assert(gmyth_query); - g_return_val_if_fail (gmyth_query->conn != NULL, FALSE); + + if (gmyth_query->conn == NULL) { + gmyth_query->conn = mysql_init (NULL); + } if (timeout != 0) { /* sets connection timeout */ @@ -139,8 +142,7 @@ gmyth_query->backend_info = backend_info; if (gmyth_query->conn == NULL) { - gmyth_query_print_error (NULL, "mysql_init() failed (probably out of memory)"); - return FALSE; + gmyth_query->conn = mysql_init (NULL); } /* connect to server */ @@ -148,7 +150,7 @@ gmyth_query->backend_info->hostname, gmyth_query->backend_info->username, gmyth_query->backend_info->password, - gmyth_query->backend_info->db_name, + gmyth_query->backend_info->db_name, 0, NULL, 0) == NULL) { gmyth_query_print_error (gmyth_query->conn, "mysql_real_connect() failed"); return FALSE; @@ -178,8 +180,9 @@ gmyth_debug ("[%s] Closing gmyth_query->conn", __FUNCTION__); mysql_close (gmyth_query->conn); + gmyth_query->conn = NULL; - return TRUE; + return TRUE; } static void