[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql 727f3c8566 022/427: Make nil correspond to NULL.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql 727f3c8566 022/427: Make nil correspond to NULL. |
Date: |
Tue, 13 Dec 2022 02:59:24 -0500 (EST) |
branch: elpa/emacsql
commit 727f3c85669fcce033000a625477d01908c21b33
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Make nil correspond to NULL.
---
emacsql-tests.el | 3 ++-
emacsql.el | 7 ++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/emacsql-tests.el b/emacsql-tests.el
index d1bcd2f41c..548eb807b6 100644
--- a/emacsql-tests.el
+++ b/emacsql-tests.el
@@ -14,4 +14,5 @@
(should (string= (emacsql-escape-value "foo") "'\"foo\"'"))
(should (string= (emacsql-escape-value :foo) "':foo'"))
(should (string= (emacsql-escape-value [1 2 3]) "'[1 2 3]'"))
- (should (string= (emacsql-escape-value '(a b c)) "'(a b c)'")))
+ (should (string= (emacsql-escape-value '(a b c)) "'(a b c)'"))
+ (should (string= (emacsql-escape-value nil) "NULL")))
diff --git a/emacsql.el b/emacsql.el
index 4c5ed414e6..a8334426ea 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -91,6 +91,7 @@ buffer. This is for debugging purposes."
(setf (process-sentinel process) (lambda (_proc _) (kill-buffer buffer)))
(process-send-string process ".prompt #\n")
(process-send-string process ".mode line\n")
+ (process-send-string process ".nullvalue nil\n")
(let ((conn (emacsql--create :process process :file file)))
(when log
(setf (emacsql-log conn) (generate-new-buffer "*emacsql-log*")))
@@ -234,9 +235,9 @@ If NAMED is non-nil, don't include column names."
(defun emacsql-escape-value (value)
"Escape VALUE for sending to SQLite."
(let ((print-escape-newlines t))
- (if (numberp value)
- (prin1-to-string value)
- (emacsql-escape (prin1-to-string value) t))))
+ (cond ((null value) "NULL")
+ ((numberp value) (prin1-to-string value))
+ (:else (emacsql-escape (prin1-to-string value) t)))))
(defun emacsql-insert (conn table &rest rows)
"Insert ROWS into TABLE.
- [nongnu] branch elpa/emacsql created (now 6b2e65bdf7), ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 08ea1e6636 005/427: Wrap with single rather than double quotes., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1f57b77c4f 007/427: Add command logging., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c7597ab813 001/427: Initial commit., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3b24b5d17c 002/427: Drop closed-p field., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 161e3a41b1 006/427: Add some tests., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 97e9764343 008/427: Change the API of emacsql-insert., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ccfafd7703 012/427: Always quote non-number values., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1074113f03 016/427: Add readability note., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 727f3c8566 022/427: Make nil correspond to NULL.,
ELPA Syncer <=
- [nongnu] elpa/emacsql f8d9511d1d 025/427: Tweak README limitations paragraph., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 2f0a9457a4 029/427: Drop non-idiomatic :else., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4f6b524b9f 026/427: Rename spec to schema., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 208885e264 031/427: Add testing to schema handling., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql abe43b3381 043/427: Add :where test., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4a89bfaf44 044/427: Use a macro to greatly simplify expanders., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql eb10ddcdba 004/427: Error-free reaping since it's automatic., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a6dbb52a3c 009/427: Add flatten option., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 2053a15b21 010/427: Add Emacs requirement note., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 961c689269 011/427: Rename information to constraints., ELPA Syncer, 2022/12/13