[libgda] Misc. optimizations



commit dace8de1085e69be7b83a1ae6ff1c3a2757d7dd7
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sun May 2 15:21:05 2010 +0200

    Misc. optimizations

 libgda/gda-connection.c             |   15 +++++++++------
 libgda/sqlite/gda-sqlite-provider.c |   13 ++++++++++++-
 2 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index d6ed18c..17c7c4d 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -1699,16 +1699,17 @@ gda_connection_add_event_string (GdaConnection *cnc, const gchar *str, ...)
 	return error;
 }
 
+/*
+ * Must be called while @cnc is locked.
+ */
 static void
 _clear_events_list (GdaConnection *cnc)
 {
-	gda_connection_lock ((GdaLockable*) cnc);
-	if (cnc->priv->events_list != NULL) {
-		g_list_foreach (cnc->priv->events_list, (GFunc) g_object_unref, NULL);
-		g_list_free (cnc->priv->events_list);
-		cnc->priv->events_list =  NULL;
+	for (; cnc->priv->events_list; ) {
+		g_object_unref ((GObject*) cnc->priv->events_list->data);
+		cnc->priv->events_list = g_list_delete_link (cnc->priv->events_list,
+							     cnc->priv->events_list);
 	}
-	gda_connection_unlock ((GdaLockable*) cnc);
 }
 
 /**
@@ -1722,7 +1723,9 @@ void
 gda_connection_clear_events_list (GdaConnection *cnc)
 {
 	g_return_if_fail (GDA_IS_CONNECTION (cnc));
+	gda_connection_lock ((GdaLockable*) cnc);
 	_clear_events_list (cnc);
+	gda_connection_unlock ((GdaLockable*) cnc);
 }
 
 /**
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index a4acd20..41e3021 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -2599,7 +2599,18 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
 			
 			GObject *set;
 			gchar *str = NULL;
-			set = (GObject*) gda_set_new_inline (1, "IMPACTED_ROWS", G_TYPE_INT, changes, NULL);
+			GdaHolder *holder;
+			GValue *value;
+			GSList *list;
+			holder = gda_holder_new (G_TYPE_INT);
+			g_object_set ((GObject*) holder, "id", "IMPACTED_ROWS", NULL);
+			g_value_set_int ((value = gda_value_new (G_TYPE_INT)), changes);
+			gda_holder_take_value (holder, value, NULL);
+			list = g_slist_append (NULL, holder);
+			set = (GObject*) gda_set_new (list);
+			g_slist_free (list);
+			g_object_unref (holder);
+
                         if (! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "DELETE", 6))
                                 str = g_strdup_printf ("DELETE %d (see SQLite documentation for a \"DELETE * FROM table\" query)",
                                                        changes);



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