Re: [gnome-db] Patch for #129560



On Tue, 2004-02-24 at 00:29, Laurent Sansonetti wrote:
> Hi,
> 
> Here is a patch to resolve defect #129560.

Added fix for #132216 in the same patch.

Cheers!

--
Laurent
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libgda/ChangeLog,v
retrieving revision 1.623
diff -u -r1.623 ChangeLog
--- ChangeLog	18 Feb 2004 13:12:58 -0000	1.623
+++ ChangeLog	25 Feb 2004 21:03:12 -0000
@@ -1,9 +1,26 @@
+2004-02-25  Laurent Sansonetti <lrz gnome org>
+
+	Fixes #132216
+
+	* libgda/gda-client.c (gda_client_open_connection_from_string): Reuses
+	existing connections by looking in the opened connections pool.
+
+	* libgda/gda-client.c (gda_client_open_connection): Fixed a memory leak.
+
+	Fixes #129560
+
+	* libgda/gda-config.c (gda_config_set_string, gda_config_set_int,
+	gda_config_set_float, gda_config_set_boolean): Changes the type of the key
+	if already existing.
+
 2004-02-18  Sergey N. Belinsky <sergey_be mail ru>
+
 	* gda-ibmdb2-recordset.c: Fixed size of data. Clean up data after use.
 	* gda-ibmdb2-types.[ch]: Fixed NUMERIC datatype. Message for unsupported datatypes.
 	* libmain.c: Removed unused options.
 
 2004-02-15  Vivien Malerba <malerba gnome-db org>
+
 	* libgda/gda-value.c: bugs fixes in gda_value_compare()
 
 2004-02-09  Tomasz Kłoczko <kloczek pld org pl>
Index: libgda/gda-client.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-client.c,v
retrieving revision 1.46
diff -u -r1.46 gda-client.c
--- libgda/gda-client.c	25 Jan 2004 00:19:43 -0000	1.46
+++ libgda/gda-client.c	25 Feb 2004 21:03:15 -0000
@@ -320,6 +320,7 @@
 		    ! (gda_connection_get_options (cnc) & GDA_CONNECTION_OPTIONS_DONT_SHARE)) {
 			g_object_ref (G_OBJECT (cnc));
 			gda_client_notify_connection_opened_event (client, cnc);
+			gda_config_free_data_source_info (dsn_info);
 			return cnc;
 		}
 	}
@@ -433,9 +434,24 @@
 	GdaDataSourceInfo *dsn_info;
 	GdaConnection *cnc;
 	static gint count = 0;
+	GList *l;
 
 	g_return_val_if_fail (GDA_IS_CLIENT (client), NULL);
 	g_return_val_if_fail (provider_id != NULL, NULL);
+	
+	if (! (options & GDA_CONNECTION_OPTIONS_DONT_SHARE)) {
+		for (l = client->priv->connections; l != NULL; l = l->next) {
+			const gchar *tmp_prov, *tmp_cnc_string;
+	
+			cnc = GDA_CONNECTION (l->data);
+			tmp_prov = gda_connection_get_provider (cnc);
+			tmp_cnc_string = gda_connection_get_cnc_string (cnc);
+	
+			if (strcmp(provider_id, tmp_prov) == 0
+			    && (cnc_string != NULL && strcmp (cnc_string, tmp_cnc_string) == 0))
+				return cnc;
+		}
+	}
 
 	/* create a temporary DSNInfo */
 	dsn_info = g_new (GdaDataSourceInfo, 1);
@@ -454,7 +470,8 @@
 				     dsn_info->password);
 
 	/* open the connection */
-	cnc = gda_client_open_connection (client, dsn_info->name,
+	cnc = gda_client_open_connection (client,
+					  dsn_info->name,
 					  dsn_info->username,
 					  dsn_info->password,
 					  options);
Index: libgda/gda-config.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-config.c,v
retrieving revision 1.55
diff -u -r1.55 gda-config.c
--- libgda/gda-config.c	19 Dec 2003 11:11:03 -0000	1.55
+++ libgda/gda-config.c	25 Feb 2004 21:03:18 -0000
@@ -598,7 +598,9 @@
 		g_free (section_path);
 	} else {
 		g_free (entry->value);
+		g_free (entry->type);
 		entry->value = g_strdup (new_value);
+		entry->type = g_strdup ("string");
 	}
 
 	write_config_file ();
@@ -642,7 +644,9 @@
 		g_free (section_path);
 	} else {
 		g_free (entry->value);
+		g_free (entry->type);
 		entry->value = g_strdup_printf ("%d", new_value);
+		entry->type = g_strdup ("long");
 	}
 
 	write_config_file ();
@@ -686,7 +690,9 @@
 		g_free (section_path);
 	} else {
 		g_free (entry->value);
+		g_free (entry->type);
 		entry->value = g_strdup_printf ("%f", new_value);
+		entry->type = g_strdup ("float");
 	}
 
 	write_config_file ();
@@ -730,7 +736,9 @@
 		g_free (section_path);
 	} else {
 		g_free (entry->value);
+		g_free (entry->type);
 		entry->value = g_strdup_printf ("%d", new_value);
+		entry->type = g_strdup ("bool");
 	}
 
 	write_config_file ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]