summaryrefslogtreecommitdiff
path: root/src/sqlite.c
Commit message (Collapse)AuthorAgeFilesLines
* ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
|
* Add 2 SQLite extensions to allow-list.Eli Zaretskii2023-11-181-0/+2
| | | | | | * 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.
* ; Support SQLite3 extensions on macOSEli Zaretskii2023-05-231-4/+6
| | | | | * src/sqlite.c (Fsqlite_load_extension): Support *.dylib extensions. (Bug#63653)
* Disable loading SQLite3 extensions when SQLite3 version is too oldEli Zaretskii2023-05-231-5/+16
| | | | | | | | * 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)
* Fix loading SQLite extensionsEli Zaretskii2023-05-201-9/+44
| | | | | | | | | | * 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.
* Minor improvements in sqlite.cEli Zaretskii2023-02-021-3/+7
| | | | | | | | * 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)
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
|
* ; * src/sqlite.c (Fsqlite_version): Doc fix.Eli Zaretskii2022-11-251-1/+2
|
* Add sqlite library version string retrieval function (bug#58766)Mattias Engdegård2022-11-251-0/+14
| | | | | | | | | | * 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.
* Fix warnings in sqlite.c in the MS-Windows buildEli Zaretskii2022-11-051-11/+21
| | | | | | | * 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.
* Make sqlite.c build with SQlite in Fedora 9Po Lu2022-11-051-4/+16
| | | | | * src/sqlite.c (sqlite_prepare_errdata): Use sqlite3_errmsg instead of sqlite3_errstr.
* ; * src/sqlite.c (Fsqlite_select): Doc fix. (Bug#58885)Eli Zaretskii2022-10-301-8/+9
|
* Include more information in error data for sqlite errorsJonas Bernoulli2022-10-281-24/+33
| | | | | | | | | | | | | | | | | 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'.
* Improve error message from sqlite-executeLars Ingebrigtsen2022-10-111-12/+20
| | | | | | | * 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.
* Support "insert into ... returning ..." in sqlite-executeLars Ingebrigtsen2022-10-101-56/+64
| | | | | | * doc/lispref/text.texi (Database): Mention it. * src/sqlite.c (Fsqlite_execute): Support syntax like "insert into ... returning ..." (bug#58390).
* Fix some indentation in Fsqlite_executeLars Ingebrigtsen2022-10-101-8/+9
| | | | * src/sqlite.c (Fsqlite_execute): Fix indentation.
* Make Fsqlite_select error data betterLars Ingebrigtsen2022-10-091-7/+11
| | | | | * src/sqlite.c (Fsqlite_select): Add more the more specific error text to the error data (bug#58363).
* Clean up Fsqlite_select slightlyLars Ingebrigtsen2022-10-091-1/+1
| | | | * src/sqlite.c (Fsqlite_select): Clean up code slightly.
* Make sqlite-select signal errors when there's an errorLars Ingebrigtsen2022-10-081-1/+5
| | | | | | * src/sqlite.c (load_dll_functions): Update. (Fsqlite_select): Signal an error when there's an error preparing the statement.
* Fix build with old sqlite librariesPo Lu2022-07-101-2/+4
| | | | | * src/sqlite.c (Fsqlite_open): Don't use SQLITE_OPEN_FULLMUTEX if not defined.
* Allow inserting and selecting binary blobs from sqliteLars Ingebrigtsen2022-04-281-9/+40
| | | | | | * doc/lispref/text.texi (Database): Document how to insert binary data. * src/sqlite.c (bind_values): Bind BLOB columns correctly (bug#54591).
* Port sqlite.c to OS X 10.6.8 with Xcode 3.2.6Paul Eggert2022-04-171-22/+20
| | | | | | | 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.
* ; * src/sqlite.c: Fix up header comment.Po Lu2022-04-021-3/+3
|
* ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
|
* Only allow SQLite extensions from an allowlistLars Ingebrigtsen2021-12-141-5/+31
| | | | | * src/sqlite.c (Fsqlite_load_extension): Only allow extensions from an allowlist.
* * src/sqlite.c (Fsqlite_open, Fsqlite_load_extension): Use ENCODE_FILE.Eli Zaretskii2021-12-131-2/+2
|
* Add a new `sqlite-pragma' commandLars Ingebrigtsen2021-12-131-0/+12
| | | | | | | * 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.
* Introduce a new sqlite-locked-errorLars Ingebrigtsen2021-12-131-2/+11
| | | | | | * 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.
* * src/sqlite.c (row_to_value): Call 'make_unibyte_string'.Eli Zaretskii2021-12-111-4/+4
|
* Minor cleanups in sqlite.cEli Zaretskii2021-12-111-12/+16
| | | | | | | | * 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.
* Minor cleanups of sqlite3 code on MS-WindowsEli Zaretskii2021-12-111-32/+16
| | | | | | | | | | * 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'.
* Fix a typo in sqlite.cEli Zaretskii2021-12-111-1/+1
| | | | | * src/sqlite.c (Fsqlite_select): Fix a typo in arguments to make_sqlite.
* Fix Fsqlite_finalize book-keepingLars Ingebrigtsen2021-12-111-1/+2
| | | | * src/sqlite.c (Fsqlite_finalize): Mark the object as dead.
* Check whether the sqlite supports sqlite3_load_extensionLars Ingebrigtsen2021-12-111-4/+13
| | | | | | | * 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.
* Fix some sqlite doc string typosLars Ingebrigtsen2021-12-111-2/+2
| | | | | * src/sqlite.c (Fsqlite_load_extension, Fsqlite_more_p): Fix typos in doc strings.
* Add sqlite3 support to EmacsLars Ingebrigtsen2021-12-111-0/+708
* 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.