[libgda] gda-vprovider-data-model: added error domain
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] gda-vprovider-data-model: added error domain
- Date: Wed, 10 Oct 2018 16:59:03 +0000 (UTC)
commit 6dffa30b159e0df940434168d56ea6fef2c0bdf3
Author: Daniel Espinosa <esodan gmail com>
Date: Wed Oct 10 10:32:26 2018 -0500
gda-vprovider-data-model: added error domain
libgda/sqlite/virtual/gda-vprovider-data-model.c | 15 +++++++++++++--
libgda/sqlite/virtual/gda-vprovider-data-model.h | 10 ++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/libgda/sqlite/virtual/gda-vprovider-data-model.c
b/libgda/sqlite/virtual/gda-vprovider-data-model.c
index 695d53be3..ad3434792 100644
--- a/libgda/sqlite/virtual/gda-vprovider-data-model.c
+++ b/libgda/sqlite/virtual/gda-vprovider-data-model.c
@@ -35,6 +35,17 @@
#include <libgda/gda-debug-macros.h>
#include <libgda/gda-server-provider-impl.h>
+
+/* module error */
+GQuark gda_vprovider_data_model_error_quark (void)
+{
+ static GQuark quark;
+ if (!quark)
+ quark = g_quark_from_static_string ("gda_vprovider_data_model_error");
+ return quark;
+}
+
+
#define GDA_DEBUG_VIRTUAL
#undef GDA_DEBUG_VIRTUAL
@@ -972,7 +983,7 @@ get_data_value (VirtualTable *vtable, VirtualCursor *cursor, gint row, gint64 ro
const GValue *value = NULL;
if ((col < 0) || (col >= vtable->td->n_columns)) {
- g_set_error (error, 0, 0, _("Column %d out of range (0-%d)"), col, vtable->td->n_columns - 1);
+ g_set_error (error, GDA_VPROVIDER_DATA_MODEL_ERROR, GDA_VPROVIDER_DATA_MODEL_GENERAL_ERROR,
_("Column %d out of range (0-%d)"), col, vtable->td->n_columns - 1);
return NULL;
}
if (cursor) {
@@ -1000,7 +1011,7 @@ get_data_value (VirtualTable *vtable, VirtualCursor *cursor, gint row, gint64 ro
value = & g_array_index (data->values_array, GValue, row * data->ncols + col);
if (!value)
- g_set_error (error, 0, 0,
+ g_set_error (error, GDA_VPROVIDER_DATA_MODEL_ERROR, GDA_VPROVIDER_DATA_MODEL_GENERAL_ERROR,
_("Could not find requested value at row %d and col %d"),
row, col);
#ifdef DEBUG_VCONTEXT
diff --git a/libgda/sqlite/virtual/gda-vprovider-data-model.h
b/libgda/sqlite/virtual/gda-vprovider-data-model.h
index a6e83c023..68198bfc4 100644
--- a/libgda/sqlite/virtual/gda-vprovider-data-model.h
+++ b/libgda/sqlite/virtual/gda-vprovider-data-model.h
@@ -22,6 +22,16 @@
#include <virtual/gda-virtual-provider.h>
+
+/* error reporting */
+extern GQuark gda_vprovider_data_model_error_quark (void);
+#define GDA_VPROVIDER_DATA_MODEL_ERROR gda_vprovider_data_model_error_quark ()
+
+typedef enum {
+ GDA_VPROVIDER_DATA_MODEL_GENERAL_ERROR
+} GdaVproviderDataModelError;
+
+
#define GDA_TYPE_VPROVIDER_DATA_MODEL (gda_vprovider_data_model_get_type())
#define GDA_VPROVIDER_DATA_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj,
GDA_TYPE_VPROVIDER_DATA_MODEL, GdaVproviderDataModel))
#define GDA_VPROVIDER_DATA_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass,
GDA_TYPE_VPROVIDER_DATA_MODEL, GdaVproviderDataModelClass))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]