[libgda/gtk3] SQlite: correctly report error message



commit 6365a00dd190dbf190263ff91d3c42a38e301320
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sun Jan 9 21:06:50 2011 +0100

    SQlite: correctly report error message
    
    instead of the "constraint failed" message
    See http://www.sqlite.org/cvstrac/tktview?tn=1640

 libgda/sqlite/gda-sqlite-provider.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index 2187c5b..fddd7e4 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -2853,12 +2853,15 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
                 changes = SQLITE3_CALL (sqlite3_changes) (handle);
                 if (status != SQLITE_DONE) {
                         if (SQLITE3_CALL (sqlite3_errcode) (handle) != SQLITE_OK) {
-				const char *errmsg = SQLITE3_CALL (sqlite3_errmsg) (handle);
+				const char *errmsg;
+                                SQLITE3_CALL (sqlite3_reset) (ps->sqlite_stmt);
+
+				errmsg = SQLITE3_CALL (sqlite3_errmsg) (handle);
                                 event = gda_connection_point_available_event (cnc, GDA_CONNECTION_EVENT_ERROR);
                                 gda_connection_event_set_description (event, errmsg);
 				g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
 					     GDA_SERVER_PROVIDER_STATEMENT_EXEC_ERROR, "%s", errmsg);
-                                SQLITE3_CALL (sqlite3_reset) (ps->sqlite_stmt);
+
                                 gda_connection_add_event (cnc, event);
 				gda_connection_internal_statement_executed (cnc, stmt, params, event);
 				if (new_ps)



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