From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: 58756@debbugs.gnu.org
Cc: Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#58756: sqlite-returning tests fails with older SQLite library versions
Date: Mon, 24 Oct 2022 11:50:00 +0200 [thread overview]
Message-ID: <5574B0A6-E5B0-47AD-AC8A-34962043D35E@gmail.com> (raw)
[-- 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))
next reply other threads:[~2022-10-24 9:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 9:50 Mattias Engdegård [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5574B0A6-E5B0-47AD-AC8A-34962043D35E@gmail.com \
--to=mattias.engdegard@gmail.com \
--cc=58756@debbugs.gnu.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.