* bug#58756: sqlite-returning tests fails with older SQLite library versions
@ 2022-10-24 9:50 Mattias Engdegård
2022-11-24 20:01 ` bug#58766: 29.0.50; Error in sqlite tests Stefan Kangas
0 siblings, 1 reply; 3+ messages in thread
From: Mattias Engdegård @ 2022-10-24 9:50 UTC (permalink / raw)
To: 58756; +Cc: Lars Ingebrigtsen
[-- Attachment #1: Type: text/plain, Size: 316 bytes --]
The recently added sqlite-returning test fails when the SQLite library does not implement RETURNING, added in 3.35.
What about adding a Lisp function for retrieving the SQLite library version? It can be used to skip this particular test but would also be useful on its own.
Proof-of-concept patch attached.
[-- Attachment #2: sqlite-version.diff --]
[-- Type: application/octet-stream, Size: 2727 bytes --]
diff --git a/src/sqlite.c b/src/sqlite.c
index 1526e344e5..761ddc8361 100644
--- a/src/sqlite.c
+++ b/src/sqlite.c
@@ -52,6 +52,7 @@ 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 const char*, sqlite3_libversion, (void));
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*));
@@ -90,6 +91,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension,
# undef sqlite3_bind_int
# undef sqlite3_errmsg
# undef sqlite3_errstr
+# undef sqlite3_libversion
# undef sqlite3_step
# undef sqlite3_changes
# undef sqlite3_column_count
@@ -115,6 +117,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension,
# define sqlite3_bind_int fn_sqlite3_bind_int
# define sqlite3_errmsg fn_sqlite3_errmsg
# define sqlite3_errstr fn_sqlite3_errstr
+# define sqlite3_libversion fn_sqlite3_libversion
# define sqlite3_step fn_sqlite3_step
# define sqlite3_changes fn_sqlite3_changes
# define sqlite3_column_count fn_sqlite3_column_count
@@ -143,6 +146,7 @@ load_dll_functions (HMODULE library)
LOAD_DLL_FN (library, sqlite3_bind_int);
LOAD_DLL_FN (library, sqlite3_errmsg);
LOAD_DLL_FN (library, sqlite3_errstr);
+ LOAD_DLL_FN (library, sqlite3_libversion);
LOAD_DLL_FN (library, sqlite3_step);
LOAD_DLL_FN (library, sqlite3_changes);
LOAD_DLL_FN (library, sqlite3_column_count);
@@ -737,6 +741,15 @@ DEFUN ("sqlite-finalize", Fsqlite_finalize, Ssqlite_finalize, 1, 1, 0,
return Qt;
}
+DEFUN ("sqlite-version", Fsqlite_version, Ssqlite_version, 0, 0, 0,
+ doc: /* SQLite library version string. */)
+ (void)
+{
+ if (!init_sqlite_functions ())
+ error ("sqlite support is not available");
+ return build_string (sqlite3_libversion ());
+}
+
#endif /* HAVE_SQLITE3 */
DEFUN ("sqlitep", Fsqlitep, Ssqlitep, 1, 1, 0,
@@ -788,6 +801,7 @@ syms_of_sqlite (void)
defsubr (&Ssqlite_columns);
defsubr (&Ssqlite_more_p);
defsubr (&Ssqlite_finalize);
+ defsubr (&Ssqlite_version);
DEFSYM (Qset, "set");
DEFSYM (Qfull, "full");
#endif
diff --git a/test/src/sqlite-tests.el b/test/src/sqlite-tests.el
index be4f60ab57..e9ddf9c0be 100644
--- a/test/src/sqlite-tests.el
+++ b/test/src/sqlite-tests.el
@@ -243,6 +243,7 @@ sqlite-blob
(ert-deftest sqlite-returning ()
(skip-unless (sqlite-available-p))
+ (skip-unless (version<= "3.35" (sqlite-version)))
(let (db)
(progn
(setq db (sqlite-open))
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-25 10:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24 9:50 bug#58756: sqlite-returning tests fails with older SQLite library versions Mattias Engdegård
2022-11-24 20:01 ` bug#58766: 29.0.50; Error in sqlite tests Stefan Kangas
2022-11-25 10:18 ` bug#58756: " Mattias Engdegård
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.