I used '#locate-library to go to the file location …/lisp/sqlite.el
There is nothing that describes the function
;;; sqlite.el --- Functions for interacting with sqlite3 databases -*- lexical-binding: t; -*-
;; Copyright (C) 2021-2024 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(declare-function sqlite-transaction "sqlite.c")
(declare-function sqlite-commit "sqlite.c")
(declare-function sqlite-rollback "sqlite.c")
(defmacro with-sqlite-transaction (db &rest body)
"Execute BODY while holding a transaction for DB.
If BODY completes normally, commit the changes and return
the value of BODY.
If BODY signals an error, or transaction commit fails, roll
back the transaction changes."
(declare (indent 1) (debug (form body)))
(let ((db-var (gensym))
(func-var (gensym))
(res-var (gensym))
(commit-var (gensym)))
`(let ((,db-var ,db)
(,func-var (lambda () ,@body))
,res-var ,commit-var)
(if (sqlite-available-p)
(unwind-protect
(progn
(sqlite-transaction ,db-var)
(setq ,res-var (funcall ,func-var))
(setq ,commit-var (sqlite-commit ,db-var))
,res-var)
(or ,commit-var (sqlite-rollback ,db-var))))
(funcall ,func-var))))
(provide 'sqlite)
;;; sqlite.el ends here
It’s a function in C. I have the same sqlite.el and I can find sqlite-open function.
Did you build your Emacs from source?
When you did, did you have sqlite dev package in your Linux distro (Debian? something like libsqlite3-dev?) – the flag is automatically on. When you do ./configure, the log output would have noted something about sqlite3, like this:
... [my omission]
Does Emacs use -lwebp? yes
Does Emacs use -lsqlite3? yes
Does Emacs use cairo? yes
Does Emacs use -llcms2? yes
Does Emacs use imagemagick? no
... [my omission]
Yes, I did compile it from source – thanks for the pointers – I will try and recompile emacs and see if it solves it and collect more data as to what is going wrong, thanks.
(sqlite-available-p)
Return t if sqlite3 support is available in this instance of Emacs.
Oh and this results in nil
I think something did go wrong during compile time – I have been lazy and copy pasting my entire emacs folder across computers
1. Install the build dependencies for Emacs:
$ sudo apt build-dep emacs
$ sudo apt install libtree-sitter-dev
2. Download and unpack the Emacs archive:
$ wget http://mirrors.nav.ro/gnu/emacs/emacs-29.1.tar.xz
$ tar xvf emacs-29.1.tar.xz
3. Install Emacs in HOME/.local/emacs/:
$ ./autogen.sh
$ ./configure --prefix="$HOME/.local/emacs/" --without-compress-install --with-native-compilation --with-json --with-mailutils --with-tree-sitter CC=gcc-12
$ make -j 4 # Replace the number 4 with the number of cores that your CPU has.
$ make install
These are the install instructions i found somewhere and used…
Thank you so much - recompiling Emacs with the libsqlite3-dev installed from the repo - compiled with sqlite3 enabled and org-roam now defaults to sqlite-builtin.