1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
From: Christopher Wellons <wellons@nullprogram.com>
Date: Fri, 26 Jun 2020 16:55:57 -0700
Subject: Compile against system sqlite3 and don't assume foreign keys enabled
https://github.com/skeeto/emacsql/issues/63#issuecomment-650455369
---
emacsql-sqlite.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/emacsql-sqlite.el b/emacsql-sqlite.el
index 1c34568..3b56e2b 100644
--- a/emacsql-sqlite.el
+++ b/emacsql-sqlite.el
@@ -78,6 +78,7 @@ http://www.sqlite.org/lang_keywords.html")
(emacsql-wait connection)
(emacsql connection [:pragma (= busy-timeout $s1)]
(/ (* emacsql-global-timeout 1000) 2))
+ (emacsql connection [:pragma (= foreign_keys 1)])
(emacsql-register connection)))
(cl-defun emacsql-sqlite (file &key debug)
@@ -139,11 +140,11 @@ If called with non-nil ASYNC the return value is meaningless."
(let* ((cc (executable-find "cc"))
(src (expand-file-name "sqlite" emacsql-sqlite-data-root))
(files (mapcar (lambda (f) (expand-file-name f src))
- '("sqlite3.c" "emacsql.c")))
+ '("emacsql.c")))
(cflags (list (format "-I%s" src) (format "-O%d" (or o-level 2))))
(ldlibs (if (memq system-type '(windows-nt berkeley-unix))
(list "-lm")
- (list "-lm" "-ldl")))
+ (list "-lm" "-ldl" "-lsqlite3")))
(options (emacsql-sqlite-compile-switches))
(output (list "-o" emacsql-sqlite-executable))
(arguments (nconc cflags options files ldlibs output)))
|