[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql cefe1ec014 121/427: Add emacsql-sqlite3-unavailabl
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql cefe1ec014 121/427: Add emacsql-sqlite3-unavailable-p. |
Date: |
Tue, 13 Dec 2022 02:59:34 -0500 (EST) |
branch: elpa/emacsql
commit cefe1ec01426231bdb79e154f5301f1500ed68b1
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Add emacsql-sqlite3-unavailable-p.
---
README.md | 2 +-
emacsql-tests.el | 1 +
emacsql.el | 18 ++++++++++++++++++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 320333fe43..9675a6fdca 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ Emacsql, including numbers, strings, symbols, lists, vectors,
and
closures. Emacsql has no concept of "TEXT" values; it's all just lisp
objects.
-Requires Emacs 24 or later.
+Requires Emacs 24 or later and SQLite 3.7.15 or later.
Due to [bad behavior from SQLite on Windows][stderr] Emacsql will
*not* signal error messages for invalid statements on this platform.
diff --git a/emacsql-tests.el b/emacsql-tests.el
index 2138d3ec96..5744e3c3a2 100644
--- a/emacsql-tests.el
+++ b/emacsql-tests.el
@@ -75,6 +75,7 @@
"CREATE TEMPORARY TABLE IF NOT EXISTS x (y);"))
(ert-deftest emacsql-system ()
+ (should-not (emacsql-sqlite3-unavailable-p))
(emacsql-with-connection (db nil)
(emacsql db [:create-table foo [x]])
(should-error (emacsql db [:create-table foo [x]]))
diff --git a/emacsql.el b/emacsql.el
index 70cf4e673c..20b04eb632 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -99,6 +99,24 @@ This collection exists for cleanup purposes.")
do (accept-process-output)))
(emacsql--clear conn))
+(defun emacsql-sqlite3-unavailable-p ()
+ "Return a reason if the sqlite3 executable is not available.
+
+:no-executable -- cannot find the executable
+:cannot-execute -- cannot run the executable
+:old-version -- sqlite3 version is too old"
+ (let ((sqlite3 emacsql-sqlite3-executable))
+ (if (null (executable-find sqlite3))
+ :no-executable
+ (condition-case _
+ (with-temp-buffer
+ (call-process sqlite3 nil (current-buffer) nil "--version")
+ (let ((version (car (split-string (buffer-string)))))
+ (if (version< version "3.7.15")
+ :old-version
+ nil)))
+ (error :cannot-execute)))))
+
(cl-defun emacsql-connect (file &key log)
"Open a connected to database stored in FILE.
If FILE is nil use an in-memory database.
- [nongnu] elpa/emacsql eb3283990e 077/427: Drop emacsql-create., (continued)
- [nongnu] elpa/emacsql eb3283990e 077/427: Drop emacsql-create., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 66df2afbf1 091/427: Simplify start-process call., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql e956d91f99 095/427: Add -identifier to emacsql-escape., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 8aade12994 101/427: Add a unit test for vector update., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql beb0e00b9e 100/427: Rename emacsql--vars-collect., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ee2877dab0 106/427: Clearer error message from escape identifier., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql e9b77b4774 112/427: Add a test for CREATE TABLE., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 652847dbf5 110/427: Allow memoization cache to be nil (for development)., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ff4c59a2a7 113/427: Fix cl-lib mistake., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f794d4d38f 116/427: Allow for selected columns in :insert-into., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql cefe1ec014 121/427: Add emacsql-sqlite3-unavailable-p.,
ELPA Syncer <=
- [nongnu] elpa/emacsql b2d83c6477 123/427: Fix up ORDER BY, drop :ascending-by., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f52af86b05 124/427: Break apart and organize compilation tests., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 0bff8ccc34 126/427: Fix up README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a362a97c98 136/427: Add README section on foreign keys., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 223db2d397 141/427: Add quote operator., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 8951084b40 143/427: Add variable escaping., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 19a65f390e 147/427: Add ignored features section to README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 530b0ad98c 151/427: Allow arbitrary sub-statements., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3012f5b725 154/427: Fix typo., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 301e2ff4b6 175/427: Drop "simple" from helper method names., ELPA Syncer, 2022/12/13