[libgda/LIBGDA_4.2] Virtual connections: report global data model exceptions



commit a71bf7c421da97fac8bdecdbfbeea291e42339aa
Author: Vivien Malerba <malerba gnome-db org>
Date:   Mon Apr 18 20:42:50 2011 +0200

    Virtual connections: report global data model exceptions

 libgda/sqlite/gda-sqlite-recordset.c             |   17 ++++++++++++++++-
 libgda/sqlite/virtual/gda-vprovider-data-model.c |    3 +++
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/libgda/sqlite/gda-sqlite-recordset.c b/libgda/sqlite/gda-sqlite-recordset.c
index c6f2c61..fb1e11d 100644
--- a/libgda/sqlite/gda-sqlite-recordset.c
+++ b/libgda/sqlite/gda-sqlite-recordset.c
@@ -1,4 +1,4 @@
-/* GDA SQLite provider
+/*
  * Copyright (C) 1998 - 2011 The GNOME Foundation.
  *
  * AUTHORS:
@@ -545,6 +545,21 @@ fetch_next_sqlite_row (GdaSqliteRecordset *model, gboolean do_store, GError **er
 			     GDA_SERVER_PROVIDER_INTERNAL_ERROR, 
 			      "%s", _("SQLite provider fatal internal error"));
 		break;
+	default: {
+		GError *lerror = NULL;
+		if (rc == SQLITE_IOERR_TRUNCATE)
+			g_set_error (&lerror, GDA_DATA_MODEL_ERROR,
+				     GDA_DATA_MODEL_TRUNCATED_ERROR, _("Tuncated data"));
+		else
+			g_set_error (&lerror, GDA_SERVER_PROVIDER_ERROR,
+				     GDA_SERVER_PROVIDER_INTERNAL_ERROR, 
+				     "%s", SQLITE3_CALL (sqlite3_errmsg) (cdata->connection));
+		gda_data_select_add_exception (GDA_DATA_SELECT (model), lerror);
+
+		GDA_DATA_SELECT (model)->advertized_nrows = model->priv->next_row_num;
+		SQLITE3_CALL (sqlite3_reset) (ps->sqlite_stmt);
+		break;
+	}
 	}
 	return prow;
 }
diff --git a/libgda/sqlite/virtual/gda-vprovider-data-model.c b/libgda/sqlite/virtual/gda-vprovider-data-model.c
index 5062278..e6754cb 100644
--- a/libgda/sqlite/virtual/gda-vprovider-data-model.c
+++ b/libgda/sqlite/virtual/gda-vprovider-data-model.c
@@ -617,6 +617,9 @@ virtualNext (sqlite3_vtab_cursor *cur)
 
 	TRACE (cur->pVtab, cur);
 
+	if (gda_data_model_get_exceptions (cursor->model))
+		return SQLITE_IOERR_TRUNCATE;
+
 	if (!gda_data_model_iter_move_next (cursor->iter)) {
 		if (gda_data_model_iter_is_valid (cursor->iter))
 			return SQLITE_IOERR;



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