unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* 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

* bug#58766: 29.0.50; Error in sqlite tests
  2022-10-24  9:50 bug#58756: sqlite-returning tests fails with older SQLite library versions Mattias Engdegård
@ 2022-11-24 20:01 ` Stefan Kangas
  2022-11-25 10:18   ` bug#58756: " Mattias Engdegård
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Kangas @ 2022-11-24 20:01 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: 58756, 58766, Lars Ingebrigtsen

Mattias Engdegård <mattias.engdegard@gmail.com> writes:

> 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.

LGTM.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#58756: bug#58766: 29.0.50; Error in sqlite tests
  2022-11-24 20:01 ` bug#58766: 29.0.50; Error in sqlite tests Stefan Kangas
@ 2022-11-25 10:18   ` Mattias Engdegård
  0 siblings, 0 replies; 3+ messages in thread
From: Mattias Engdegård @ 2022-11-25 10:18 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 58756-done, 58766, Lars Ingebrigtsen

Thank you, pushed to master (adding an entry to the manual).






^ permalink raw reply	[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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).