[libgda/LIBGDA_4.2] GdaMetaStore: correctly fill the GdaMetaStoreChange structure when data is deleted



commit 0d1c854a2e9099368c341345b7a505ef02bb4932
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sun Jan 8 20:43:50 2012 +0100

    GdaMetaStore: correctly fill the GdaMetaStoreChange structure when data is deleted

 libgda/gda-meta-store.c |   35 +++++++++++++++++------------------
 1 files changed, 17 insertions(+), 18 deletions(-)
---
diff --git a/libgda/gda-meta-store.c b/libgda/gda-meta-store.c
index 2811acb..9f1d6c7 100644
--- a/libgda/gda-meta-store.c
+++ b/libgda/gda-meta-store.c
@@ -2858,6 +2858,7 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
 						goto out;
 					}
 					if (change) {
+						/*g_print ("CH %p key=[%s] value=[%s]\n", change, pid, gda_value_stringify (value)); */
 						g_hash_table_insert (change->keys, pid, gda_value_copy (value));
 						pid = NULL;
 					}
@@ -2903,6 +2904,7 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
 							goto out;
 						}
 						if (change) {
+							/* g_print ("CH %p key=[%s] value=[%s]\n", change, pid, gda_value_stringify (value)); */
 							g_hash_table_insert (change->keys, pid, gda_value_copy (value));
 							pid = NULL;
 						}
@@ -3001,26 +3003,23 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
 				for (j = 0; j < current_n_cols; j++) {
 					gchar *pid = g_strdup_printf ("-%d", j);
 					GdaHolder *h;
+					const GValue *value;
+					value = gda_data_model_get_value_at (current, j, i, error);
+					if (!value) {
+						g_free (pid);
+						retval = FALSE;
+						goto out;
+					}
+
 					h = gda_set_get_holder (schema_set->params, pid);
-					if (h) {
-						const GValue *value;
-						value = gda_data_model_get_value_at (current, j, i, error);
-						if (!value) {
-							g_free (pid);
-							retval = FALSE;
-							goto out;
-						}
-						if (! gda_holder_set_value (h, value, error)) {
-							g_free (pid);
-							retval = FALSE;
-							goto out;
-						}
-						if (change) {
-							g_hash_table_insert (change->keys, pid, gda_value_copy (value));
-							pid = NULL;
-						}
+					if (h && ! gda_holder_set_value (h, value, error)) {
+						g_free (pid);
+						retval = FALSE;
+						goto out;
 					}
-					g_free (pid);
+
+					/* g_print ("CH %p key=[%s] value=[%s]\n", change, pid, gda_value_stringify (value)); */
+					g_hash_table_insert (change->keys, pid, gda_value_copy (value));
 				}
 #ifdef DEBUG_STORE_MODIFY
 				g_print ("Delete existing row %d from table %s\n", i, table_name);



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