[libgda] Virtual provider: fixed reporting of errors while getting data
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Virtual provider: fixed reporting of errors while getting data
- Date: Mon, 1 Dec 2014 21:44:39 +0000 (UTC)
commit 3491056aa302ede712d8da567ee26103c0f2ed68
Author: Vivien Malerba <malerba gnome-db org>
Date: Mon Dec 1 20:42:56 2014 +0100
Virtual provider: fixed reporting of errors while getting data
libgda/gda-data-model-iter.c | 23 +++++++++++++++------
libgda/sqlite/virtual/gda-vprovider-data-model.c | 7 +++++-
2 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/libgda/gda-data-model-iter.c b/libgda/gda-data-model-iter.c
index f2fd5a4..6ad4bca 100644
--- a/libgda/gda-data-model-iter.c
+++ b/libgda/gda-data-model-iter.c
@@ -1061,8 +1061,12 @@ gda_data_model_iter_get_value_at (GdaDataModelIter *iter, gint col)
g_return_val_if_fail (iter->priv, NULL);
param = (GdaHolder *) g_slist_nth_data (((GdaSet *) iter)->holders, col);
- if (param)
- return gda_holder_get_value (param);
+ if (param) {
+ if (gda_holder_is_valid (param))
+ return gda_holder_get_value (param);
+ else
+ return NULL;
+ }
else
return NULL;
}
@@ -1089,9 +1093,10 @@ gda_data_model_iter_get_value_at_e (GdaDataModelIter *iter, gint col, GError **e
param = (GdaHolder *) g_slist_nth_data (((GdaSet *) iter)->holders, col);
if (param) {
- if (error)
- gda_holder_is_valid_e (param, error);
- return gda_holder_get_value (param);
+ if (gda_holder_is_valid_e (param, error))
+ return gda_holder_get_value (param);
+ else
+ return NULL;
}
else
return NULL;
@@ -1145,8 +1150,12 @@ gda_data_model_iter_get_value_for_field (GdaDataModelIter *iter, const gchar *fi
g_return_val_if_fail (iter->priv, NULL);
param = gda_set_get_holder ((GdaSet *) iter, field_name);
- if (param)
- return gda_holder_get_value (param);
+ if (param) {
+ if (gda_holder_is_valid (param))
+ return gda_holder_get_value (param);
+ else
+ return NULL;
+ }
else
return NULL;
}
diff --git a/libgda/sqlite/virtual/gda-vprovider-data-model.c
b/libgda/sqlite/virtual/gda-vprovider-data-model.c
index 6207adf..0393eaf 100644
--- a/libgda/sqlite/virtual/gda-vprovider-data-model.c
+++ b/libgda/sqlite/virtual/gda-vprovider-data-model.c
@@ -1018,9 +1018,14 @@ virtualColumn (sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i)
else if (G_VALUE_TYPE (value) == G_TYPE_ERROR) {
GError *lerror;
lerror = g_value_get_boxed (value);
- //SQLITE3_CALL (sqlite3_result_error) (ctx, lerror && lerror->message ? lerror->message :
_("No detail"), -1);
+ /* Can't call:
+ * SQLITE3_CALL (sqlite3_result_error) (ctx, lerror && lerror->message ? lerror->message :
_("No detail"), -1);
+ * because then the whole processing stops and no further rows are read */
if (lerror)
lerror = g_error_copy (lerror);
+ else
+ g_set_error (&lerror, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_DATA_ERROR,
+ _("No detail"));
g_hash_table_insert (error_blobs_hash, lerror, GINT_TO_POINTER (1));
SQLITE3_CALL (sqlite3_result_blob) (ctx, lerror, sizeof (GError), NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]