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



commit 7e678d7794fe080bfe1b8481d7e0c0c9fac9d89b
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.
    
    Conflicts:
    
    	addressbook/libedata-book/e-book-backend-sqlitedb.c

 .../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 aefcb25..0531c9d 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -295,7 +295,10 @@ book_backend_sql_exec_real (sqlite3 *db,
 	if (ret != SQLITE_OK) {
 		d (g_print ("Error in SQL EXEC statement: %s [%s].\n", stmt, errmsg));
 		g_set_error_literal (
-			error, E_BOOK_SDB_ERROR, E_BOOK_SDB_ERROR_OTHER, errmsg);
+			error, E_BOOK_SDB_ERROR,
+			ret == SQLITE_CONSTRAINT ?
+			E_BOOK_SDB_ERROR_CONSTRAINT : E_BOOK_SDB_ERROR_OTHER,
+			errmsg);
 		sqlite3_free (errmsg);
 		errmsg = NULL;
 		return FALSE;



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