Function: emacsql-sqlite-default-connection
emacsql-sqlite-default-connection is a byte-compiled function defined
in emacsql-sqlite.el.
Signature
(emacsql-sqlite-default-connection &optional USE-MODULE)
Documentation
Determine and return the best SQLite connection class.
Signal an error if none of the connection classes can be used.
If optional USE-MODULE is non-nil, then use the external module even when Emacs was built with SQLite support. This is intended for testing purposes.
Source Code
;; Defined in ~/.emacs.d/elpa/emacsql-20261001.1544/emacsql-sqlite.el
(defun emacsql-sqlite-default-connection (&optional use-module)
"Determine and return the best SQLite connection class.
Signal an error if none of the connection classes can be used.
If optional USE-MODULE is non-nil, then use the external module even
when Emacs was built with SQLite support. This is intended for testing
purposes."
(or (and (not use-module)
(fboundp 'sqlite-available-p)
(sqlite-available-p)
(require 'emacsql-sqlite-builtin)
'emacsql-sqlite-builtin-connection)
(and (boundp 'module-file-suffix)
module-file-suffix
(condition-case nil
;; Failure modes:
;; 1. `libsqlite' shared library isn't available.
;; 2. User chooses to not compile `libsqlite'.
;; 3. `libsqlite' compilation fails.
(and (require 'sqlite3)
(require 'emacsql-sqlite-module)
'emacsql-sqlite-module-connection)
(error
(display-warning 'emacsql "\
Since your Emacs does not come with
built-in SQLite support [1], but does support C modules, we can
use an EmacSQL backend that relies on the third-party `sqlite3'
package [2].
Please install the `sqlite3' Elisp package using your preferred
Emacs package manager, and install the SQLite shared library
using your distribution's package manager. That package should
be named something like `libsqlite3' [3] and NOT just `sqlite3'.
The legacy backend, which uses a custom SQLite executable, has
been remove, so we can no longer fall back to that.
[1]: Supported since Emacs 29.1, provided it was not disabled
with `--without-sqlite3'.
[2]: https://github.com/pekingduck/emacs-sqlite3-api
[3]: On Debian https://packages.debian.org/buster/libsqlite3-0")
;; The buffer displaying the warning might immediately
;; be replaced by another buffer, before the user gets
;; a chance to see it. We cannot have that.
(let (fn)
(setq fn (lambda ()
(remove-hook 'post-command-hook fn)
(pop-to-buffer (get-buffer "*Warnings*"))))
(add-hook 'post-command-hook fn))
nil)))
(error "EmacSQL could not find or compile a back-end")))