From 49160969ced3482398b9ae616fa482bc92ce9e34 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 8 Oct 2022 15:41:14 +0200 Subject: [PATCH] Make sqlite-select signal errors when there's an error * src/sqlite.c (load_dll_functions): Update. (Fsqlite_select): Signal an error when there's an error preparing the statement. --- src/sqlite.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sqlite.c b/src/sqlite.c index 54bfb7b6c61..9375b44da25 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -51,6 +51,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_bind_double, (sqlite3_stmt*, int, double)); DEF_DLL_FN (SQLITE_API int, sqlite3_bind_null, (sqlite3_stmt*, int)); DEF_DLL_FN (SQLITE_API int, sqlite3_bind_int, (sqlite3_stmt*, int, int)); DEF_DLL_FN (SQLITE_API const char*, sqlite3_errmsg, (sqlite3*)); +DEF_DLL_FN (SQLITE_API const char*, sqlite3_errstr, (int)); DEF_DLL_FN (SQLITE_API int, sqlite3_step, (sqlite3_stmt*)); DEF_DLL_FN (SQLITE_API int, sqlite3_changes, (sqlite3*)); DEF_DLL_FN (SQLITE_API int, sqlite3_column_count, (sqlite3_stmt*)); @@ -88,6 +89,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, # undef sqlite3_bind_null # undef sqlite3_bind_int # undef sqlite3_errmsg +# undef sqlite3_errstr # undef sqlite3_step # undef sqlite3_changes # undef sqlite3_column_count @@ -112,6 +114,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, # define sqlite3_bind_null fn_sqlite3_bind_null # define sqlite3_bind_int fn_sqlite3_bind_int # define sqlite3_errmsg fn_sqlite3_errmsg +# define sqlite3_errstr fn_sqlite3_errstr # define sqlite3_step fn_sqlite3_step # define sqlite3_changes fn_sqlite3_changes # define sqlite3_column_count fn_sqlite3_column_count @@ -139,6 +142,7 @@ load_dll_functions (HMODULE library) LOAD_DLL_FN (library, sqlite3_bind_null); LOAD_DLL_FN (library, sqlite3_bind_int); LOAD_DLL_FN (library, sqlite3_errmsg); + LOAD_DLL_FN (library, sqlite3_errstr); LOAD_DLL_FN (library, sqlite3_step); LOAD_DLL_FN (library, sqlite3_changes); LOAD_DLL_FN (library, sqlite3_column_count); @@ -528,7 +532,7 @@ which means that we return a set object that can be queried with { if (stmt) sqlite3_finalize (stmt); - + errmsg = sqlite3_errstr (ret); goto exit; } -- 2.39.5