1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-10 05:30:45 -08:00

Add a new `sqlite-pragma' command

* doc/lispref/text.texi (Database): Document it.
* src/sqlite.c (Fsqlite_pragma): Add a separate command for
pragmas.  These can be done via sqlite-execute, but it's less
confusing to have them in a separate command.
This commit is contained in:
Lars Ingebrigtsen 2021-12-13 06:08:09 +01:00
parent c86b86f9a9
commit 9ce0fe5ef4
2 changed files with 27 additions and 0 deletions

View file

@ -574,6 +574,17 @@ DEFUN ("sqlite-rollback", Fsqlite_rollback, Ssqlite_rollback, 1, 1, 0,
return sqlite_exec (XSQLITE (db)->db, "rollback");
}
DEFUN ("sqlite-pragma", Fsqlite_pragma, Ssqlite_pragma, 2, 2, 0,
doc: /* Execute PRAGMA in DB. */)
(Lisp_Object db, Lisp_Object pragma)
{
check_sqlite (db, false);
CHECK_STRING (pragma);
return sqlite_exec (XSQLITE (db)->db,
SSDATA (concat2 (build_string ("PRAGMA "), pragma)));
}
#ifdef HAVE_SQLITE3_LOAD_EXTENSION
DEFUN ("sqlite-load-extension", Fsqlite_load_extension,
Ssqlite_load_extension, 2, 2, 0,
@ -689,6 +700,7 @@ syms_of_sqlite (void)
defsubr (&Ssqlite_transaction);
defsubr (&Ssqlite_commit);
defsubr (&Ssqlite_rollback);
defsubr (&Ssqlite_pragma);
#ifdef HAVE_SQLITE3_LOAD_EXTENSION
defsubr (&Ssqlite_load_extension);
#endif