[libgda/LIBGDA_4.0] SQlite: correctly report error message



commit ac1839e424b3f328861e23c8afff6495e3d81c30
Author: Vivien Malerba <malerba gnome-db org>
Date:   Wed Mar 23 17:57:36 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 |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index b4b0209..d3c4ea0 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -2568,12 +2568,15 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
                 changes = sqlite3_changes (handle);
                 if (status != SQLITE_DONE) {
                         if (sqlite3_errcode (handle) != SQLITE_OK) {
-				const char *errmsg = sqlite3_errmsg (handle);
-                                event = gda_connection_event_new (GDA_CONNECTION_EVENT_ERROR);
+				const char *errmsg;
+                                sqlite3_reset (ps->sqlite_stmt);
+
+				errmsg = sqlite3_errmsg (handle);
+				event = gda_connection_event_new (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_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]