From aeaa81f44bfba399236b561f3ef153e9f8d403fa Mon Sep 17 00:00:00 2001 From: Alexey Romanov Date: Sat, 23 Mar 2013 22:05:06 +0400 Subject: [PATCH] Return result from en/disabling extension loading Previously the return value of `sqlite3_enable_load_extension` was ignored. --- c_src/sqlite3_drv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/c_src/sqlite3_drv.c b/c_src/sqlite3_drv.c index 525a13c..e2f8aee 100644 --- a/c_src/sqlite3_drv.c +++ b/c_src/sqlite3_drv.c @@ -249,9 +249,14 @@ static inline int output_ok(sqlite3_drv_t *drv) { static int enable_load_extension(sqlite3_drv_t* drv, char *buf, int len) { #ifdef ERLANG_SQLITE3_LOAD_EXTENSION char enable = buf[0]; - sqlite3_enable_load_extension(drv->db, (int) enable); - output_ok(drv); - return 0; + int result = sqlite3_enable_load_extension(drv->db, (int) enable); + if (result) { + output_db_error(drv); + return result; + } else { + output_ok(drv); + return 0; + } #else output_error(drv, SQLITE_MISUSE, "extension loading not enabled"); return -1;