pekingduck / emacs-sqlite3-api Goto Github PK
View Code? Open in Web Editor NEWSQLite3 API for GNU Emacs 25+
License: GNU General Public License v3.0
SQLite3 API for GNU Emacs 25+
License: GNU General Public License v3.0
Hi,
I did followings:
git clone https://github.com/pekingduck/emacs-sqlite
cd emacs-sqlite3-api/
make
gcc -g3 -Wall -std=c99 -I. -fPIC -c sqlite3-api.c
In file included from sqlite3-api.c:1041:0:
consts.c: In function ‘emacs_module_init’:
consts.c:266:55: warning: passing argument 2 of ‘env->make_integer’ makes integer from pointer without a cast [-Wint-conversion]
defconst(env, "sqlite-static", env->make_integer(env, SQLITE_STATIC));
^~~~~~~~~~~~~
consts.c:266:55: note: expected ‘intmax_t {aka long int}’ but argument is of type ‘void (*)(void )’
consts.c:267:58: warning: passing argument 2 of ‘env->make_integer’ makes integer from pointer without a cast [-Wint-conversion]
defconst(env, "sqlite-transient", env->make_integer(env, SQLITE_TRANSIENT));
^~~~~~~~~~~~~~~~
consts.c:267:58: note: expected ‘intmax_t {aka long int}’ but argument is of type ‘void ()(void *)’
gcc -shared -o sqlite3-api.so sqlite3-api.o -lsqlite3
rm sqlite3-api.o
Is this normal?
Best, Pal
it looks like libsqlite3-dev
(development headers + files) is a requirement for debian? otherwise i receive the above error.
I swim upstream from here syl20bnr/spacemacs#15992. Read at the end for extra details.
I recently performed a clean install of Spacemacs (because of reasons) with rm -rf ~/.emacs.d && git clone [...] && emacs
. After that, when accessing the status of a git repository, a message would urge me to install sqlite3
(reported at r/spacemacs). Doing so and issuing M-m g s
crashes Emacs.
git
layer enabledsqlite3
sudo apt install libsqlite3-{0,dev}
sqlite3
to dotspacemacs-additional-packages
(M-m f e d
)M-m q R
sqlite3
M-m g s
sqlite3.el
Observed behaviour: 👀 💔
emacsql
will eventually print the the following message.Warning (emacsql): Since your Emacs does not come with
built-in SQLite support [1], but does support C modules, the best
EmacSQL backend is provided by 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'.
In the current Emacs instance the legacy backend is used, which
uses a custom SQLite executable. Using an external process like
that is less reliable and less performant, and in a few releases
support for that might be removed.
[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 Disable showing Disable logging
Expected behaviour: ❤️ 😄
sqlite3
should be taken care of by the git
layer or at least be documented.
libsqlite3-dev
is only needed at compile time.(auto-completion better-defaults bibtex
(c-c++ :variables c-c++-backend 'lsp-clangd)
emacs-lisp epub git helm html
(julia :variables julia-backend 'lsp julia-repl-switches "--threads 8")
(latex :variables latex-enable-auto-fill nil latex-enable-magic nil)
(lsp :variables lsp-julia-default-environment "~/.julia/environments/v1.8")
markdown mu4e multiple-cursors octave org pdf
(shell :variables shell-default-position 'right shell-default-shell 'vterm)
shell-scripts spacemacs-org spell-checking syntax-checking version-control treemacs
(yaml :variables yaml-enable-lsp t))
I don't know.
Under Arch Linux / Emacs 28.2, things are ok. Therefore, I guess there must be something distro related. Moreover, pay attention to the steps to reproduce: at the first run, there is no crash. I have to go through step 7 to trigger the crash, which means to have to restart Emacs after sqlite3-api.so has been built.
I am preparing for the release of emacsql
4.0.0.
This adds two new SQLite backends. The new preferred backend uses the new built-in SQLite support in Emacs 29. If that cannot be used, then the other new backend, which uses your module, should be used. Only if that isn't available either should the old backend be used, which uses a custom sqlite binary.
(Also see magit/emacsql#113)
Since emacsql
is also available from NonGNU-devel Elpa, and will be available from NonGNU Elpa once I release 4.0.0, it would be good to add this package there as well. Otherwise users that aren't yet on Emacs 29 would be stuck on the old backend, which uses the binary.
If you agree, I can take care of proposing that in emacs-devel
and add the necessary metadata.
Hello @pekingduck,
I'm packaging this repository for GNU Guix. Could you please help me with this and add a version to this Emacs package and create a Git tag for it? This would allow me to get rid of these warnings when linting this package via guix lint
.
/home/roman/workspace/guix/gnu/packages/emacs-xyz.scm:5741:14: warning: no tags were found for emacs-sqlite3-api
/home/roman/workspace/guix/gnu/packages/emacs-xyz.scm:5741:14: [email protected]: updater 'github' failed to find upstream releases
Thanks, Roman.
Hi,
the sqlite3-api
module is not loaded after it is first build from MELPA and throws an error when trying to use any of the module functions:
Symbol's function definition is void: sqlite3-set-log-level
To reproduce
issue.el
that will install sqlite3
from MELPA in a temporary package directory, load the package and then try to call the sqlite3-set-log-level
fn(let* ((tmp-dir (make-temp-file "" t))
(package-user-dir tmp-dir))
(message "::Initializing package system in %s" tmp-dir)
(unwind-protect
(progn
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(message "::Installing SQLite3 package...")
(package-install 'sqlite3)
(message "::Loading SQLite3...")
(require 'sqlite3)
;; (require 'sqlite3-api)
(message "::Setting SQLite3 log level...")
(sqlite3-set-log-level 0)
(message "::Done"))
;; remove temp dir
(delete-directory tmp-dir t)))
sqlite3-set-log-level
fn. Even though loading the sqlite3
package was successful. $ emacs -Q --batch -l issue.el
::Initializing package system in c:/Users/xyz/AppData/Local/Temp/WflbzL
::Installing SQLite3 package...
Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Package refresh done
Contacting host: elpa.nongnu.org:443
Contacting host: elpa.nongnu.org:443
Package refresh done
Contacting host: melpa.org:443
Package refresh done
Setting `package-selected-packages' temporarily since "emacs -q" would overwrite customizations
Setting `package-selected-packages' temporarily since "emacs -q" would overwrite customizations
Contacting host: melpa.org:443
Parsing tar file...
Parsing tar file...done
Extracting... \
Extracting...done
INFO Scraping files for loaddefs...
INFO Scraping files for loaddefs...done
GEN sqlite3-autoloads.el
Checking c:/Users/xyz/AppData/Local/Temp/WflbzL/sqlite3-20230315.1221...
Compiling c:/Users/xyz/AppData/Local/Temp/WflbzL/sqlite3-20230315.1221/sqlite3-autoloads.el...
Compiling c:/Users/xyz/AppData/Local/Temp/WflbzL/sqlite3-20230315.1221/sqlite3-pkg.el...
Compiling c:/Users/xyz/AppData/Local/Temp/WflbzL/sqlite3-20230315.1221/sqlite3.el...
Done (Total of 1 file compiled, 2 skipped)
Package `sqlite3' installed.
::Loading SQLite3...
::Setting SQLite3 log level...
Error: void-function (sqlite3-set-log-level)
...
Symbol's function definition is void: sqlite3-set-log-level
What happened here is that the package compiled the sqlite-api.c
file but it has not loaded.
Contrast that if we uncommented the (require 'sqlite3-api) line, and run the same command on the shell, the
sqlite3-set-log-level` is found and no exception is thrown:
$ emacs -Q --batch -l issue.el
::Initializing package system in c:/Users/xyz/AppData/Local/Temp/uCgL0E
::Installing SQLite3 package...
Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Package refresh done
Contacting host: elpa.nongnu.org:443
Package refresh done
Contacting host: melpa.org:443
Contacting host: melpa.org:443
Package refresh done
Setting `package-selected-packages' temporarily since "emacs -q" would overwrite customizations
Setting `package-selected-packages' temporarily since "emacs -q" would overwrite customizations
Contacting host: melpa.org:443
Parsing tar file...
Parsing tar file...done
Extracting... \
Extracting...done
INFO Scraping files for loaddefs...
INFO Scraping files for loaddefs...done
GEN sqlite3-autoloads.el
Checking c:/Users/xyz/AppData/Local/Temp/uCgL0E/sqlite3-20230315.1221...
Compiling c:/Users/xyz/AppData/Local/Temp/uCgL0E/sqlite3-20230315.1221/sqlite3-autoloads.el...
Compiling c:/Users/xyz/AppData/Local/Temp/uCgL0E/sqlite3-20230315.1221/sqlite3-pkg.el...
Compiling c:/Users/xyz/AppData/Local/Temp/uCgL0E/sqlite3-20230315.1221/sqlite3.el...
Done (Total of 1 file compiled, 2 skipped)
Package `sqlite3' installed.
::Loading SQLite3...
::Setting SQLite3 log level...
::Done
The expectation here is that the module is loaded even when sqlite3
is required and has to do the compilation, providing a seamless experience to the user.
patch to follow.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.