[libgda] Virtual provider: improved error reporting
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Virtual provider: improved error reporting
- Date: Thu, 1 Sep 2011 19:14:53 +0000 (UTC)
commit 3d61dbb7bd5790f51481d8e263166a1218144c34
Author: Vivien Malerba <malerba gnome-db org>
Date: Thu Sep 1 19:58:04 2011 +0200
Virtual provider: improved error reporting
libgda/sqlite/virtual/gda-vprovider-data-model.c | 26 +++++++++------------
1 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/libgda/sqlite/virtual/gda-vprovider-data-model.c b/libgda/sqlite/virtual/gda-vprovider-data-model.c
index 3703974..26ef901 100644
--- a/libgda/sqlite/virtual/gda-vprovider-data-model.c
+++ b/libgda/sqlite/virtual/gda-vprovider-data-model.c
@@ -1169,16 +1169,14 @@ virtualUpdate (sqlite3_vtab *tab, int nData, sqlite3_value **apData, sqlite_int6
if (! vtable->td->modif_stmt [ptype]) {
if (! stmt) {
tab->zErrMsg = SQLITE3_CALL (sqlite3_mprintf)
- (_("No statement provided to modify the data model "
- "representing the table"));
+ (_("No statement provided to modify the data"));
return SQLITE_READONLY;
}
GdaSet *params;
if (! gda_statement_get_parameters (stmt, ¶ms, NULL) || !params) {
tab->zErrMsg = SQLITE3_CALL (sqlite3_mprintf)
- (_("Invalid statement provided to modify the data model "
- "representing the table"));
+ (_("Invalid statement provided to modify the data"));
g_object_unref (stmt);
return SQLITE_READONLY;
}
@@ -1197,8 +1195,7 @@ virtualUpdate (sqlite3_vtab *tab, int nData, sqlite3_value **apData, sqlite_int6
id = gda_holder_get_id (holder);
if (!id) {
tab->zErrMsg = SQLITE3_CALL (sqlite3_mprintf)
- (_("Invalid parameter in statement provided to modify "
- "the data model representing the table"));
+ (_("Invalid parameter in statement to modify the data"));
return SQLITE_READONLY;
}
if (*id == '+' && id[1]) {
@@ -1251,8 +1248,7 @@ virtualUpdate (sqlite3_vtab *tab, int nData, sqlite3_value **apData, sqlite_int6
if (! exec_set) {
/* can't give value to param named @id */
tab->zErrMsg = SQLITE3_CALL (sqlite3_mprintf)
- (_("Invalid parameter in statement provided to modify "
- "the data model representing the table"));
+ (_("Invalid parameter in statement to modify the data"));
return SQLITE_READONLY;
}
eh = gda_set_get_holder (exec_set, id);
@@ -1260,8 +1256,7 @@ virtualUpdate (sqlite3_vtab *tab, int nData, sqlite3_value **apData, sqlite_int6
! gda_holder_set_bind (holder, eh, NULL)) {
/* can't give value to param named @id */
tab->zErrMsg = SQLITE3_CALL (sqlite3_mprintf)
- (_("Invalid parameter in statement provided to modify "
- "the data model representing the table"));
+ (_("Invalid parameter in statement to modify the data"));
return SQLITE_READONLY;
}
}
@@ -1269,10 +1264,10 @@ virtualUpdate (sqlite3_vtab *tab, int nData, sqlite3_value **apData, sqlite_int6
GdaConnection *cnc;
cnc = gda_data_select_get_connection (GDA_DATA_SELECT (vtable->td->real_model));
-
+
+ GError *lerror = NULL;
#ifdef GDA_DEBUG_NO
gchar *sql;
- GError *lerror = NULL;
sql = gda_statement_to_sql (stmt, NULL, NULL);
g_print ("SQL: [%s] ", sql);
g_free (sql);
@@ -1290,11 +1285,12 @@ virtualUpdate (sqlite3_vtab *tab, int nData, sqlite3_value **apData, sqlite_int6
if (!cnc ||
(gda_connection_statement_execute_non_select (cnc, stmt,
vtable->td->modif_params [ptype],
- NULL, NULL) == -1)) {
+ NULL, &lerror) == -1)) {
/* failed to execute */
tab->zErrMsg = SQLITE3_CALL (sqlite3_mprintf)
- (_("Failed to execute the statement provided to modify "
- "the data model representing the table"));
+ (_("Failed to modify data: %s"),
+ lerror && lerror->message ? lerror->message : _("No detail"));
+ g_clear_error (&lerror);
return SQLITE_READONLY;
}
return SQLITE_OK;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]