[libgda] LDAP provider: return an error if an attribute has multi values and no rule specified to "merge" the
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] LDAP provider: return an error if an attribute has multi values and no rule specified to "merge" the
- Date: Mon, 1 Dec 2014 21:44:44 +0000 (UTC)
commit adeec48b0344f5f478698353ccafad6340d6dbc2
Author: Vivien Malerba <malerba gnome-db org>
Date: Mon Dec 1 20:43:43 2014 +0100
LDAP provider: return an error if an attribute has multi values and no rule specified to "merge" them
providers/ldap/gdaprov-data-model-ldap.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/providers/ldap/gdaprov-data-model-ldap.c b/providers/ldap/gdaprov-data-model-ldap.c
index 591dcac..57db7a5 100644
--- a/providers/ldap/gdaprov-data-model-ldap.c
+++ b/providers/ldap/gdaprov-data-model-ldap.c
@@ -716,7 +716,7 @@ worker_update_iter_from_ldap_row (WorkerIterData *data, GError **error)
BerElement* ber;
char *attr;
GdaHolder *holder;
- gint j, nb;
+ gint j;
GSList *holders_set = NULL;
g_object_get (G_OBJECT (data->iter), "update-model", &update_model, NULL);
@@ -750,11 +750,9 @@ worker_update_iter_from_ldap_row (WorkerIterData *data, GError **error)
else
gda_holder_force_invalid (holder);
- nb = g_slist_length (((GdaSet*) data->iter)->holders);
- for (j = 1; j < nb; j++) {
- holder = (GdaHolder*) (g_slist_nth_data (((GdaSet*) data->iter)->holders, j));
- gda_holder_set_value (holder, NULL, NULL);
- }
+ GSList *list;
+ for (list = GDA_SET (data->iter)->holders->next; list; list = list->next)
+ gda_holder_set_value (GDA_HOLDER (list->data), NULL, NULL);
if (data->imodel->priv->row_mult)
goto out;
@@ -865,10 +863,14 @@ worker_update_iter_from_ldap_row (WorkerIterData *data, GError **error)
gda_holder_force_invalid (holder);
break;
case MULTIPLE_VALUE_ACTION_SET_INVALID:
- default:
- gda_holder_force_invalid (holder);
+ default: {
+ GError *lerror = NULL;
+ g_set_error (&lerror, GDA_SERVER_PROVIDER_ERROR,
GDA_SERVER_PROVIDER_DATA_ERROR,
+ _("Multiple value LDAP attribute does not fit into a
single value"));
+ gda_holder_force_invalid_e (holder, lerror);
break;
}
+ }
}
else if (bvals[0]) {
/* convert string to the correct type */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]