Commit graph

17 commits

Author SHA1 Message Date
Po Lu
d7120d9766 Fix build with old sqlite libraries
* src/sqlite.c (Fsqlite_open): Don't use SQLITE_OPEN_FULLMUTEX
if not defined.
2022-07-10 15:23:55 +08:00
Lars Ingebrigtsen
5d032f2904 Allow inserting and selecting binary blobs from sqlite
* doc/lispref/text.texi (Database): Document how to insert binary
data.
* src/sqlite.c (bind_values): Bind BLOB columns correctly (bug#54591).
2022-04-28 14:58:53 +02:00
Paul Eggert
0bb8e127b0 Port sqlite.c to OS X 10.6.8 with Xcode 3.2.6
Problem reported by Keith David Bershatsky in:
https://lists.gnu.org/r/emacs-devel/2022-04/msg00923.html
* src/sqlite.c (Fsqlite_open): Don’t assume SQLITE_OPEN_MEMORY
is defined.
2022-04-17 17:55:45 -07:00
Po Lu
b312959ebd ; * src/sqlite.c: Fix up header comment. 2022-04-02 16:31:13 +08:00
Eli Zaretskii
823b6b8d26 ; Add 2022 to copyright years. 2022-01-01 07:07:15 -05:00
Lars Ingebrigtsen
8c0f9be0d1 Only allow SQLite extensions from an allowlist
* src/sqlite.c (Fsqlite_load_extension): Only allow extensions
from an allowlist.
2021-12-14 09:29:13 +01:00
Eli Zaretskii
57efc5d1bb * src/sqlite.c (Fsqlite_open, Fsqlite_load_extension): Use ENCODE_FILE. 2021-12-13 15:35:31 +02:00
Lars Ingebrigtsen
9ce0fe5ef4 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.
2021-12-13 06:08:09 +01:00
Lars Ingebrigtsen
c86b86f9a9 Introduce a new sqlite-locked-error
* src/sqlite.c (Fsqlite_execute): Use it.
(syms_of_sqlite): Introduce a new error for locked databases so
that we can catch that condition on higher levels.
2021-12-13 05:38:29 +01:00
Eli Zaretskii
facddfc803 * src/sqlite.c (row_to_value): Call 'make_unibyte_string'. 2021-12-11 12:05:54 +02:00
Eli Zaretskii
4cdc59f33a Minor cleanups in sqlite.c
* src/sqlite.c (Fsqlite_open): Signal an error if
'init_sqlite_functions' fails.  Encode FILE using UTF-8.
(Fsqlite_close, Fsqlite_execute, Fsqlite_select)
(Fsqlite_load_extension): Doc fixes.
(Fsqlite_load_extension): Encode MODULE using UTF-8.
2021-12-11 11:54:44 +02:00
Eli Zaretskii
628306c299 Minor cleanups of sqlite3 code on MS-Windows
* src/sqlite.c (sqlite_loaded_p): Function deleted: not used
anymore.
(init_sqlite_functions) [WINDOWSNT]: Use a static 'bool' variable
to indicate if sqlite3 DLL was successfully loaded.
(Fsqlite_available_p) [WINDOWSNT]: Just call
'init_sqlite_functions' if Vlibrary_cache doesn't mention
'sqlite3'.
2021-12-11 11:26:04 +02:00
Eli Zaretskii
6c81683a27 Fix a typo in sqlite.c
* src/sqlite.c (Fsqlite_select): Fix a typo in arguments to
make_sqlite.
2021-12-11 10:51:09 +02:00
Lars Ingebrigtsen
17569c9495 Fix Fsqlite_finalize book-keeping
* src/sqlite.c (Fsqlite_finalize): Mark the object as dead.
2021-12-11 08:18:09 +01:00
Lars Ingebrigtsen
ebf59d1a28 Check whether the sqlite supports sqlite3_load_extension
* configure.ac: Check for sqlite3_load_extension, which is
apparently missing in some versions.
* src/sqlite.c: Add guards.
(Fsqlite_load_extension): Ifdef out on systems that doesn't have it.
2021-12-11 06:40:01 +01:00
Lars Ingebrigtsen
385f2faf34 Fix some sqlite doc string typos
* src/sqlite.c (Fsqlite_load_extension, Fsqlite_more_p): Fix typos
in doc strings.
2021-12-11 06:26:37 +01:00
Lars Ingebrigtsen
3d38d1d134 Add sqlite3 support to Emacs
* configure.ac: Add check for the sqlite library.
* doc/lispref/text.texi (Database): Document it.

* lisp/sqlite.el: New file.

* lisp/term/w32-win.el (dynamic-library-alist): Add a mapping.

* src/Makefile.in (SQLITE3_LIBS): Add the libraries.

* src/alloc.c (union emacs_align_type): Add a Lisp_Sqlite struct.

* src/data.c (Ftype_of): Add sqlite.

* src/emacs.c (main): Load the syms.

* src/lisp.h (DEFINE_GDB_SYMBOL_BEGIN): Add PVEC_SQLITE.
(GCALIGNED_STRUCT): New struct to keep data for sqlite database
objects and statement objects.
(SQLITEP, SQLITE, CHECK_SQLITE, XSQLITE): New macros for accessing
the objects.

* src/pdumper.c (dump_vectorlike): Update hash.
(dump_vectorlike): Don't dump it.

* src/print.c (print_vectorlike): Add a printer for the sqlite
object.

* src/sqlite.c: New file.

* test/src/sqlite-tests.el: Add tests.
2021-12-11 04:55:57 +01:00