1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-29 16:41:45 -08:00
Commit graph

41 commits

Author SHA1 Message Date
Stefan Kangas
a799661566 Standardize possessive apostrophe usage in manuals, docs, and comments
See the note in admin/notes/documentation.
Ref: https://lists.gnu.org/r/emacs-devel/2012-02/msg00649.html
2024-07-25 03:35:18 +02:00
Eli Zaretskii
07b1a36f78 ; * src/sqlite.c (Fsqlite_load_extension): Add "vec0" to allowed extensions. 2024-07-20 10:27:52 +03:00
Eli Zaretskii
9da2faf73b ; Fix last change in sqlite.c
* etc/NEWS:
* doc/lispref/text.texi (Database):
* src/sqlite.c (Fsqlite_execute_batch): Fix last change (Bug#70145).
2024-06-06 13:06:58 +03:00
Javier Olaechea
23ef989935 Add 'sqlite-execute-batch' command
This command is similar to 'sqlite-execute' except that it
executes multiple statements in exchange for not accepting
any arguments.  (Bug#70145)
* src/sqlite.c (Fsqlite_execute_batch): New function.

* test/src/sqlite-tests.el (sqlite-multiple-statements): Add
smoke test for 'sqlite-execute-batch'.

* etc/NEWS: Mention new command 'sqlite-execute-batch'.
* doc/lispref/text.texi (Database): Document the new command.
2024-06-06 12:51:46 +03:00
Stefan Monnier
63e67916b0 Followup changes to cl-type-of
These changes came up while working on `cl-type-of` but are not
directly related to the new `cl-type-of`.
The BASE_PURESIZE bump was needed at some point on one of my
machine, not sure why.

* src/puresize.h (BASE_PURESIZE): Bump up.
* src/sqlite.c (bind_value): Don't use `Ftype_of`.
* lisp/emacs-lisp/seq.el (seq-remove-at-position): Simplify.
* lisp/emacs-lisp/cl-preloaded.el (finalizer):
New (previously missing) type.
* doc/lispref/objects.texi (Type Predicates): Minor tweaks.
2024-03-18 09:32:53 -04:00
Po Lu
8e1c56ae46 ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
Eli Zaretskii
3327f36ad9 Add 2 SQLite extensions to allow-list.
* src/sqlite.c (Fsqlite_load_extension): Add 2 Free Software
extensions to the allow-list.  For the details, see
https://lists.gnu.org/archive/html/emacs-devel/2023-11/msg00234.html.
2023-11-18 11:11:04 +02:00
Eli Zaretskii
765edc204d ; Support SQLite3 extensions on macOS
* src/sqlite.c (Fsqlite_load_extension): Support *.dylib
extensions.  (Bug#63653)
2023-05-23 17:53:07 +03:00
Eli Zaretskii
a347b26cba Disable loading SQLite3 extensions when SQLite3 version is too old
* src/sqlite.c (HAVE_LOAD_EXTENSION): Define to 1 only if
enabling/disabling extension loading is supported as well.
(load_dll_functions, Fsqlite_load_extension): Condition on
HAVE_LOAD_EXTENSION, not on HAVE_SQLITE3_LOAD_EXTENSION.
(Bug#63653)
2023-05-23 14:30:31 +03:00
Eli Zaretskii
ead3a2abbf Fix loading SQLite extensions
* src/sqlite.c (sqlite3_db_config) [WINDOWSNT]: Load from the DLL.
(Fsqlite_load_extension): Use 'sqlite3_db_config' to enable and
disable loading of extensions.  Add a few free extensions to the
allow-list.  Fix testing for the ".dll" extension.  (Bug#63590)

* test/src/sqlite-tests.el (sqlite-load-extension): Fix the test
to require successful load if the extension does exist.
2023-05-20 15:43:44 +03:00
Eli Zaretskii
20454128b8 Minor improvements in sqlite.c
* src/sqlite.c (Fsqlite_next): Doc fix.  Return nil if SQLITE_DONE
was once seen for this statement.  (Bug#61151)
(row_to_value): Cons the value in reverse, to avoid the Fnreverse
call.  Patch by Helmut Eller <eller.helmut@gmail.com>.
(Bug#61165)
2023-02-02 21:45:44 +02:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Eli Zaretskii
98c69b2556 ; * src/sqlite.c (Fsqlite_version): Doc fix. 2022-11-25 15:00:07 +02:00
Mattias Engdegård
f35dc7058b Add sqlite library version string retrieval function (bug#58766)
* src/sqlite.c (sqlite3_libversion, load_dll_functions):
Make sqlite3_libversion available.
(Fsqlite_version): New.
(syms_of_sqlite): Define sqlite-version.
* doc/lispref/text.texi (Database): Document.
* test/src/sqlite-tests.el (sqlite-returning): `RETURNING` was added
in sqlite 3.35; skip the test for older versions.
2022-11-25 11:03:10 +01:00
Eli Zaretskii
ae497d75f7 Fix warnings in sqlite.c in the MS-Windows build
* src/sqlite.c (sqlite3_errstr) [WINDOWSNT]: Define and load from
the DLL only if the SQLite3 version is at least 3.7.15.
(sqlite_prepare_errdata) [SQLITE_VERSION_NUMBER >= 3007015]: Use
the original code if sqlite3_errstr is available.
2022-11-05 14:28:53 +02:00
Po Lu
ae7dcba6c5 Make sqlite.c build with SQlite in Fedora 9
* src/sqlite.c (sqlite_prepare_errdata): Use sqlite3_errmsg
instead of sqlite3_errstr.
2022-11-05 19:43:30 +08:00
Eli Zaretskii
3ceaa91829 ; * src/sqlite.c (Fsqlite_select): Doc fix. (Bug#58885) 2022-10-30 10:31:00 +02:00
Jonas Bernoulli
1073e16960 Include more information in error data for sqlite errors
Introduce a new 'sqlite-error' and use it for all errors signaled in
'src/sqlite.c', except those that already used 'sqlite-locked-error'.
Include the values of 'sqlite3_errcode', 'sqlite3_extended_errcode',
'sqlite3_errstr' and 'sqlite3_errmsg' in the error data.

* src/sqlite.c (load_dll_functions): Load 'sqlite3_extended_errcode'.
(sqlite-load-extension): Use 'xsignal1' as required by argument type.
(syms_of_sqlite): Introduce a new error type 'sqlite-error'.
(check_sqlite, sqlite-open, bind_values, sqlite-execute)
(sqlite-select, sqlite-load-extension, sqlite-next): Use it.
(sqlite_prepare_errdata): New function.
(sqlite_prepare_errmsg): Remove function.
(sqlite-execute, sqlite-select): Use new function.
(sqlite-locked-error): Derive from 'sqlite-error'.
2022-10-28 14:33:49 +02:00
Lars Ingebrigtsen
36ab164496 Improve error message from sqlite-execute
* src/sqlite.c (sqlite_prepare_errmsg): New function.
(Fsqlite_execute): Use it to get the same error format for both
execute and select.
(Fsqlite_select): Factored out from here.
2022-10-11 02:18:19 +02:00
Lars Ingebrigtsen
7e7dc74ffb Support "insert into ... returning ..." in sqlite-execute
* doc/lispref/text.texi (Database): Mention it.
* src/sqlite.c (Fsqlite_execute): Support syntax like "insert into
... returning ..." (bug#58390).
2022-10-10 10:58:33 +02:00
Lars Ingebrigtsen
7ab6ec364d Fix some indentation in Fsqlite_execute
* src/sqlite.c (Fsqlite_execute): Fix indentation.
2022-10-10 10:35:46 +02:00
Lars Ingebrigtsen
b5dc0513d5 Make Fsqlite_select error data better
* src/sqlite.c (Fsqlite_select): Add more the more specific error
text to the error data (bug#58363).
2022-10-09 16:17:22 +02:00
Lars Ingebrigtsen
0ce91ed8b4 Clean up Fsqlite_select slightly
* src/sqlite.c (Fsqlite_select): Clean up code slightly.
2022-10-09 15:38:52 +02:00
Lars Ingebrigtsen
49160969ce Make sqlite-select signal errors when there's an error
* src/sqlite.c (load_dll_functions): Update.
(Fsqlite_select): Signal an error when there's an error preparing
the statement.
2022-10-08 15:41:14 +02:00
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