[libgda] Misc virtual connection corrections



commit ec5b6105239aff87025296fd753d277dd07ef3c7
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sun Apr 22 15:00:37 2012 +0200

    Misc virtual connection corrections

 libgda/sqlite/virtual/gda-vconnection-data-model.c |    4 ++--
 libgda/sqlite/virtual/gda-vprovider-data-model.c   |   14 ++++++++++----
 2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/libgda/sqlite/virtual/gda-vconnection-data-model.c b/libgda/sqlite/virtual/gda-vconnection-data-model.c
index 2dba80c..debf4b8 100644
--- a/libgda/sqlite/virtual/gda-vconnection-data-model.c
+++ b/libgda/sqlite/virtual/gda-vconnection-data-model.c
@@ -664,8 +664,8 @@ _gda_vconnection_set_working_obj (GdaVconnectionDataModel *cnc, GObject *obj)
 	else {
 		for (list = cnc->priv->table_data_list; list; list = list->next) {
 			GdaVConnectionTableData *td = (GdaVConnectionTableData*) list->data;
-
-			g_assert (td->context.current_vcontext);
+			/* REM: td->context.current_vcontext may already be NULL in case
+			 * an exception already occurred */
 			td->context.current_vcontext = NULL;
 		}
 		g_mutex_unlock (cnc->priv->lock_context);
diff --git a/libgda/sqlite/virtual/gda-vprovider-data-model.c b/libgda/sqlite/virtual/gda-vprovider-data-model.c
index d3c1de3..23595d2 100644
--- a/libgda/sqlite/virtual/gda-vprovider-data-model.c
+++ b/libgda/sqlite/virtual/gda-vprovider-data-model.c
@@ -839,10 +839,16 @@ virtualNext (sqlite3_vtab_cursor *cur)
 			g_assert (count == data->ncols);
 		}
 		else {
-			/* end of data */
-			g_object_unref (data->iter);
-			data->iter = NULL;
-			data->nrows = cursor->row;
+			int exc_res;
+			exc_res = handle_data_model_exception (cur->pVtab, data->model);
+			if (exc_res != SQLITE_OK)
+				goto onerror;
+			else {
+				/* end of data */
+				g_object_unref (data->iter);
+				data->iter = NULL;
+				data->nrows = cursor->row;
+			}
 		}
 	}
 	return SQLITE_OK;



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