[evolution-data-server/openismus-work] Using proper error code for reporting SQL constraint errors.



commit 016c7b96be3dd340fd31ecf94e7f427ea8fbd642
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Mon Jan 21 18:25:33 2013 +0900

    Using proper error code for reporting SQL constraint errors.

 .../libedata-book/e-book-backend-sqlitedb.c        |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.c b/addressbook/libedata-book/e-book-backend-sqlitedb.c
index 960393a..758ade6 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -303,9 +303,12 @@ book_backend_sql_exec_real (sqlite3 *db,
 
 	if (ret != SQLITE_OK) {
 		d(g_print ("Error in SQL EXEC statement: %s [%s] RETURN CODE: %d.\n", stmt, errmsg, ret));
+
 		g_set_error (
 			error, E_BOOK_SDB_ERROR,
-			E_BOOK_SDB_ERROR_OTHER, "%s", errmsg);
+			ret == SQLITE_CONSTRAINT ?
+			E_BOOK_SDB_ERROR_CONSTRAINT : E_BOOK_SDB_ERROR_OTHER,
+			"%s", errmsg);
 		sqlite3_free (errmsg);
 		errmsg = NULL;
 		return FALSE;



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