# HG changeset patch # User leo_sobral # Date 1173369238 0 # Node ID 74c9ba2e13ec8dff30df4a8f1a41913a578c93d9 # Parent 0a187bf1e9afa373b2d0c32e106dcc599de51806 [svn r407] removed unused variables, fixed indentation amd removed msqlquery unrefing from disconnect, moving it to the dispose diff -r 0a187bf1e9af -r 74c9ba2e13ec gmyth/src/gmyth_query.c --- a/gmyth/src/gmyth_query.c Thu Mar 08 00:33:45 2007 +0000 +++ b/gmyth/src/gmyth_query.c Thu Mar 08 15:53:58 2007 +0000 @@ -66,10 +66,8 @@ /* initialize connection handler */ gmyth_query->conn = mysql_init (NULL); - if (!(gmyth_query->conn)) g_warning ("[%s] MSQL structure not initialized", __FUNCTION__); - } static void @@ -114,7 +112,8 @@ if (timeout != 0) { /* sets connection timeout */ - mysql_options (gmyth_query->conn, MYSQL_OPT_CONNECT_TIMEOUT, (gchar*) &timeout); + mysql_options (gmyth_query->conn, MYSQL_OPT_CONNECT_TIMEOUT, + (gchar*) &timeout); } return gmyth_query_connect (gmyth_query, backend_info); @@ -146,20 +145,21 @@ /* connect to server */ if (mysql_real_connect (gmyth_query->conn, - gmyth_query->backend_info->hostname, - gmyth_query->backend_info->username, - gmyth_query->backend_info->password, - gmyth_query->backend_info->db_name, - 0, NULL, 0) == NULL) { - + gmyth_query->backend_info->hostname, + gmyth_query->backend_info->username, + gmyth_query->backend_info->password, + gmyth_query->backend_info->db_name, + 0, NULL, 0) == NULL) { gmyth_query_print_error (gmyth_query->conn, "mysql_real_connect() failed"); return FALSE; } g_debug ("[%s] Connection to Mysql server succeeded! (host = %s, user = %s, "\ "password = %s, db name = %s)", __FUNCTION__, - 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->hostname, + gmyth_query->backend_info->username, + gmyth_query->backend_info->password, + gmyth_query->backend_info->db_name ); return TRUE; } @@ -176,6 +176,7 @@ /* TODO: Check how to return error */ g_debug ("[%s] Closing gmyth_query->conn", __FUNCTION__); + mysql_close (gmyth_query->conn); return TRUE; diff -r 0a187bf1e9af -r 74c9ba2e13ec gmyth/src/gmyth_query.h --- a/gmyth/src/gmyth_query.h Thu Mar 08 00:33:45 2007 +0000 +++ b/gmyth/src/gmyth_query.h Thu Mar 08 15:53:58 2007 +0000 @@ -51,10 +51,10 @@ struct _GMythQueryClass { - GObjectClass parent_class; + GObjectClass parent_class; - /* callbacks */ - /* no one for now */ + /* callbacks */ + /* no one for now */ }; struct _GMythQuery @@ -63,23 +63,23 @@ GMythBackendInfo *backend_info; - GString *opt_socket_name; /* socket name (use built-in value) */ - unsigned int opt_flags; /* connection flags (none) */ - - MYSQL *conn; /* pointer to connection handler */ + /* pointer to connection handler */ + MYSQL *conn; }; -GType gmyth_query_get_type (void); +GType gmyth_query_get_type (void); -GMythQuery* gmyth_query_new ( ); -MYSQL_RES * gmyth_query_process_statement - (GMythQuery *gmyth_query, gchar *stmt_str); +GMythQuery* gmyth_query_new (void); +MYSQL_RES * gmyth_query_process_statement (GMythQuery *gmyth_query, + gchar *stmt_str); -gboolean gmyth_query_connect (GMythQuery *gmyth_query, GMythBackendInfo *backend_info); -gboolean gmyth_query_connect_with_timeout (GMythQuery *gmyth_query, - GMythBackendInfo *backend_info, guint timeout); -gboolean gmyth_query_disconnect (GMythQuery *gmyth_query); +gboolean gmyth_query_connect (GMythQuery *gmyth_query, + GMythBackendInfo *backend_info); +gboolean gmyth_query_connect_with_timeout (GMythQuery *gmyth_query, + GMythBackendInfo *backend_info, + guint timeout); +gboolean gmyth_query_disconnect (GMythQuery *gmyth_query); G_END_DECLS diff -r 0a187bf1e9af -r 74c9ba2e13ec gmyth/src/gmyth_scheduler.c --- a/gmyth/src/gmyth_scheduler.c Thu Mar 08 00:33:45 2007 +0000 +++ b/gmyth/src/gmyth_scheduler.c Thu Mar 08 15:53:58 2007 +0000 @@ -115,20 +115,11 @@ scheduler->msqlquery = NULL; } - if (scheduler->profile != NULL) - g_string_free (scheduler->profile, TRUE); - - if (scheduler->recgroup != NULL) - g_string_free (scheduler->recgroup, TRUE); - - if (scheduler->playgroup != NULL) - g_string_free (scheduler->playgroup, TRUE); - - if (scheduler->search_type != NULL) - g_string_free (scheduler->search_type, TRUE); - - if (scheduler->search_what != NULL) - g_string_free (scheduler->search_what, TRUE); + g_string_free (scheduler->profile, TRUE); + g_string_free (scheduler->recgroup, TRUE); + g_string_free (scheduler->playgroup, TRUE); + g_string_free (scheduler->search_type, TRUE); + g_string_free (scheduler->search_what, TRUE); G_OBJECT_CLASS (gmyth_scheduler_parent_class)->dispose (object); } @@ -202,7 +193,6 @@ if (scheduler->msqlquery != NULL) { gmyth_query_disconnect (scheduler->msqlquery); - g_object_unref (scheduler->msqlquery); } return TRUE;