[svn r407] removed unused variables, fixed indentation amd removed msqlquery unrefing from disconnect, moving it to the dispose trunk
authorleo_sobral
Thu Mar 08 15:53:58 2007 +0000 (2007-03-08)
branchtrunk
changeset 40274c9ba2e13ec
parent 401 0a187bf1e9af
child 403 89cd1cc77cd1
[svn r407] removed unused variables, fixed indentation amd removed msqlquery unrefing from disconnect, moving it to the dispose
gmyth/src/gmyth_query.c
gmyth/src/gmyth_query.h
gmyth/src/gmyth_scheduler.c
     1.1 --- a/gmyth/src/gmyth_query.c	Thu Mar 08 00:33:45 2007 +0000
     1.2 +++ b/gmyth/src/gmyth_query.c	Thu Mar 08 15:53:58 2007 +0000
     1.3 @@ -66,10 +66,8 @@
     1.4      /* initialize connection handler */
     1.5      gmyth_query->conn = mysql_init (NULL);
     1.6  
     1.7 -    
     1.8      if (!(gmyth_query->conn))
     1.9      	g_warning ("[%s] MSQL structure not initialized", __FUNCTION__);
    1.10 -
    1.11  }
    1.12  
    1.13  static void
    1.14 @@ -114,7 +112,8 @@
    1.15  
    1.16      if (timeout != 0) {
    1.17          /* sets connection timeout */
    1.18 -        mysql_options (gmyth_query->conn, MYSQL_OPT_CONNECT_TIMEOUT, (gchar*) &timeout);
    1.19 +        mysql_options (gmyth_query->conn, MYSQL_OPT_CONNECT_TIMEOUT, 
    1.20 +                       (gchar*) &timeout);
    1.21      }
    1.22  
    1.23      return gmyth_query_connect (gmyth_query, backend_info);
    1.24 @@ -146,20 +145,21 @@
    1.25      
    1.26      /* connect to server */
    1.27      if (mysql_real_connect (gmyth_query->conn, 
    1.28 -	    gmyth_query->backend_info->hostname, 
    1.29 -            gmyth_query->backend_info->username,
    1.30 -	    gmyth_query->backend_info->password,
    1.31 -	    gmyth_query->backend_info->db_name, 
    1.32 -            0, NULL, 0) == NULL) {
    1.33 -            	
    1.34 +                    	    gmyth_query->backend_info->hostname, 
    1.35 +                            gmyth_query->backend_info->username,
    1.36 +            	            gmyth_query->backend_info->password,
    1.37 +        	                gmyth_query->backend_info->db_name, 
    1.38 +                            0, NULL, 0) == NULL) {            	
    1.39          gmyth_query_print_error (gmyth_query->conn, "mysql_real_connect() failed");
    1.40  		return FALSE;
    1.41      }
    1.42  
    1.43      g_debug ("[%s] Connection to Mysql server succeeded! (host = %s, user = %s, "\
    1.44      			"password = %s, db name = %s)", __FUNCTION__, 
    1.45 -    			gmyth_query->backend_info->hostname, gmyth_query->backend_info->username,
    1.46 -	    		gmyth_query->backend_info->password, gmyth_query->backend_info->db_name );
    1.47 +    			gmyth_query->backend_info->hostname, 
    1.48 +                gmyth_query->backend_info->username,
    1.49 +	    		gmyth_query->backend_info->password, 
    1.50 +                gmyth_query->backend_info->db_name );
    1.51      
    1.52      return TRUE;
    1.53  }
    1.54 @@ -176,6 +176,7 @@
    1.55      
    1.56      /* TODO: Check how to return error */
    1.57      g_debug ("[%s] Closing gmyth_query->conn", __FUNCTION__);
    1.58 +
    1.59      mysql_close (gmyth_query->conn);
    1.60  
    1.61  	return TRUE;	
     2.1 --- a/gmyth/src/gmyth_query.h	Thu Mar 08 00:33:45 2007 +0000
     2.2 +++ b/gmyth/src/gmyth_query.h	Thu Mar 08 15:53:58 2007 +0000
     2.3 @@ -51,10 +51,10 @@
     2.4  
     2.5  struct _GMythQueryClass
     2.6  {
     2.7 -  GObjectClass parent_class;
     2.8 +    GObjectClass parent_class;
     2.9  
    2.10 -  /* callbacks */
    2.11 -  /* no one for now */
    2.12 +    /* callbacks */
    2.13 +    /* no one for now */
    2.14  };
    2.15  
    2.16  struct _GMythQuery
    2.17 @@ -63,23 +63,23 @@
    2.18    
    2.19      GMythBackendInfo *backend_info;
    2.20  
    2.21 -    GString *opt_socket_name; /* socket name (use built-in value) */
    2.22 -    unsigned int opt_flags; /* connection flags (none) */
    2.23 -
    2.24 -    MYSQL *conn; /* pointer to connection handler */  
    2.25 +    /* pointer to connection handler */
    2.26 +    MYSQL *conn;  
    2.27  };
    2.28  
    2.29  
    2.30 -GType gmyth_query_get_type (void);
    2.31 +GType       gmyth_query_get_type (void);
    2.32  
    2.33 -GMythQuery* gmyth_query_new ( );
    2.34 -MYSQL_RES * gmyth_query_process_statement 
    2.35 -                (GMythQuery *gmyth_query, gchar *stmt_str);
    2.36 +GMythQuery* gmyth_query_new (void);
    2.37 +MYSQL_RES * gmyth_query_process_statement (GMythQuery *gmyth_query,
    2.38 +                                           gchar *stmt_str);
    2.39  
    2.40 -gboolean gmyth_query_connect (GMythQuery *gmyth_query, GMythBackendInfo *backend_info);
    2.41 -gboolean gmyth_query_connect_with_timeout (GMythQuery *gmyth_query,
    2.42 -	                GMythBackendInfo *backend_info, guint timeout);
    2.43 -gboolean gmyth_query_disconnect (GMythQuery *gmyth_query);
    2.44 +gboolean    gmyth_query_connect (GMythQuery *gmyth_query,
    2.45 +                                 GMythBackendInfo *backend_info);
    2.46 +gboolean    gmyth_query_connect_with_timeout (GMythQuery *gmyth_query,
    2.47 +	                                          GMythBackendInfo *backend_info,
    2.48 +                                              guint timeout);
    2.49 +gboolean    gmyth_query_disconnect (GMythQuery *gmyth_query);
    2.50  
    2.51  G_END_DECLS
    2.52  
     3.1 --- a/gmyth/src/gmyth_scheduler.c	Thu Mar 08 00:33:45 2007 +0000
     3.2 +++ b/gmyth/src/gmyth_scheduler.c	Thu Mar 08 15:53:58 2007 +0000
     3.3 @@ -115,20 +115,11 @@
     3.4          scheduler->msqlquery = NULL;
     3.5      }
     3.6  
     3.7 -    if (scheduler->profile != NULL)
     3.8 -        g_string_free (scheduler->profile, TRUE);
     3.9 -
    3.10 -    if (scheduler->recgroup != NULL)
    3.11 -        g_string_free (scheduler->recgroup, TRUE);
    3.12 -
    3.13 -    if (scheduler->playgroup != NULL)
    3.14 -        g_string_free (scheduler->playgroup, TRUE);
    3.15 -
    3.16 -    if (scheduler->search_type != NULL)
    3.17 -        g_string_free (scheduler->search_type, TRUE);
    3.18 -
    3.19 -    if (scheduler->search_what != NULL)
    3.20 -        g_string_free (scheduler->search_what, TRUE);
    3.21 +    g_string_free (scheduler->profile, TRUE);
    3.22 +    g_string_free (scheduler->recgroup, TRUE);
    3.23 +    g_string_free (scheduler->playgroup, TRUE);
    3.24 +    g_string_free (scheduler->search_type, TRUE);
    3.25 +    g_string_free (scheduler->search_what, TRUE);
    3.26  
    3.27      G_OBJECT_CLASS (gmyth_scheduler_parent_class)->dispose (object);
    3.28  }
    3.29 @@ -202,7 +193,6 @@
    3.30  
    3.31      if (scheduler->msqlquery != NULL) {
    3.32          gmyth_query_disconnect (scheduler->msqlquery);
    3.33 -        g_object_unref (scheduler->msqlquery);
    3.34      }
    3.35  
    3.36      return TRUE;