[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql 6ad267f93b 229/427: Change :value to :scalar.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql 6ad267f93b 229/427: Change :value to :scalar. |
Date: |
Tue, 13 Dec 2022 02:59:46 -0500 (EST) |
branch: elpa/emacsql
commit 6ad267f93b2562ea8ef7200f88a3fa1378f92dda
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Change :value to :scalar.
---
emacsql-compiler.el | 22 +++++++++++-----------
emacsql-tests.el | 14 +++++++-------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/emacsql-compiler.el b/emacsql-compiler.el
index 5aabf4faa9..34d3498300 100644
--- a/emacsql-compiler.el
+++ b/emacsql-compiler.el
@@ -51,7 +51,7 @@
(setf string (replace-regexp-in-string "-" "_" string))
string))
-(defun emacsql-escape-value (value)
+(defun emacsql-escape-scalar (value)
"Escape VALUE for sending to SQLite."
(let ((print-escape-newlines t))
(cond ((null value) "NULL")
@@ -63,7 +63,7 @@
(cl-typecase vector
(null (emacsql-error "Empty SQL vector expression."))
(list (mapconcat #'emacsql-escape-vector vector ", "))
- (vector (concat "(" (mapconcat #'emacsql-escape-value vector ", ") ")"))
+ (vector (concat "(" (mapconcat #'emacsql-escape-scalar vector ", ") ")"))
(otherwise (emacsql-error "Invalid vector %S" vector))))
;; Statement compilers:
@@ -139,12 +139,12 @@ a list of (<string> [arg-pos] ...)."
(let ((thing (nth i args)))
(cl-case kind
(:identifier (emacsql-escape-identifier thing))
- (:value (emacsql-escape-value thing))
+ (:scalar (emacsql-escape-scalar thing))
(:vector (emacsql-escape-vector thing))
(:schema (car (emacsql--schema-to-string thing)))
(:auto (if (and thing (symbolp thing))
(emacsql-escape-identifier thing)
- (emacsql-escape-value thing)))
+ (emacsql-escape-scalar thing)))
(otherwise
(emacsql-error "Invalid var type %S" kind))))))))
@@ -162,10 +162,10 @@ symbol is returned."
(defun emacsql-escape-format (thing &optional kind)
"Escape THING for use as a `format' spec, pre-escaping for KIND.
-KIND should be :value or :identifier."
+KIND should be :scalar or :identifier."
(replace-regexp-in-string
"%" "%%" (cl-case kind
- (:value (emacsql-escape-value thing))
+ (:scalar (emacsql-escape-scalar thing))
(:identifier (emacsql-escape-identifier thing))
(:vector (emacsql-escape-vector thing))
(otherwise thing))))
@@ -181,9 +181,9 @@ KIND should be :value or :identifier."
(prog1 "%s"
(setf emacsql--vars (nconc emacsql--vars (list (cons var kind)))))
(cl-case kind
- ((:identifier :value :vector) (emacsql-escape-format thing kind))
+ ((:identifier :scalar :vector) (emacsql-escape-format thing kind))
(:auto (emacsql-escape-format
- thing (if (and thing (symbolp thing)) :identifier :value)))
+ thing (if (and thing (symbolp thing)) :identifier :scalar)))
(otherwise (emacsql-error "Invalid var type: %S" kind))))))
(defun emacsql--vars-combine (expanded)
@@ -221,7 +221,7 @@ definitions for return from a `emacsql-defexpander'."
(:non-nil (push "NOT NULL" output))
(:unique (push "UNIQUE" output))
(:default (push "DEFAULT" output)
- (push (var (pop column) :value) output))
+ (push (var (pop column) :scalar) output))
(:check (push "CHECK" output)
(push (format "(%s)" (expr (pop column))) output))
(:references
@@ -301,7 +301,7 @@ definitions for return from a `emacsql-defexpander'."
(list
(mapconcat (lambda (v) (combine (emacsql--vector v))) vector ", "))
(vector
- (format "(%s)" (mapconcat (lambda (x) (var x :value)) vector ", ")))
+ (format "(%s)" (mapconcat (lambda (x) (var x :scalar)) vector ", ")))
(otherwise (emacsql-error "Invalid vector: %S" vector)))))
(defun emacsql--expr (expr)
@@ -355,7 +355,7 @@ definitions for return from a `emacsql-defexpander'."
;; quote special case
((quote)
(cl-case (length args)
- (1 (var (nth 0 args) :value))
+ (1 (var (nth 0 args) :scalar))
(otherwise (nops op))))
;; funcall special case
((funcall)
diff --git a/emacsql-tests.el b/emacsql-tests.el
index 15ca448a42..282bfe25af 100644
--- a/emacsql-tests.el
+++ b/emacsql-tests.el
@@ -39,13 +39,13 @@
(should (string= (emacsql-escape-identifier 'foo$) "foo$"))
(should (string= (emacsql-escape-identifier "foo:bar") "foo.bar")))
-(ert-deftest emacsql-escape-value ()
- (should (string= (emacsql-escape-value 'foo) "'foo'"))
- (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 nil) "NULL")))
+(ert-deftest emacsql-escape-scalar ()
+ (should (string= (emacsql-escape-scalar 'foo) "'foo'"))
+ (should (string= (emacsql-escape-scalar "foo") "'\"foo\"'"))
+ (should (string= (emacsql-escape-scalar :foo) "':foo'"))
+ (should (string= (emacsql-escape-scalar [1 2 3]) "'[1 2 3]'"))
+ (should (string= (emacsql-escape-scalar '(a b c)) "'(a b c)'"))
+ (should (string= (emacsql-escape-scalar nil) "NULL")))
(ert-deftest emacsql-escape-vector ()
(should (string= (emacsql-escape-vector [1 2 3]) "(1, 2, 3)"))
- [nongnu] elpa/emacsql e42d939235 187/427: In SQLite, block for up to 30 seconds on db lock., (continued)
- [nongnu] elpa/emacsql e42d939235 187/427: In SQLite, block for up to 30 seconds on db lock., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3ba9109d45 198/427: Start using real version numbers., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql de0bde9a02 207/427: Use Cask package-file directive instead., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql bb3dbfc891 213/427: Set a global query timeout., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 394bb062aa 219/427: Add a small library for determining binary to use., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f030b9952d 224/427: Fix up psql-connection., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql dc2afbbc1f 221/427: Adjust the Emacsql wire protocol., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 6318472b20 223/427: Link the Makefiles together., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a7728339ba 216/427: Switch to custom middleware., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ab53199d07 232/427: Fix escaping issue in middleware., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 6ad267f93b 229/427: Change :value to :scalar.,
ELPA Syncer <=
- [nongnu] elpa/emacsql 1146f2e26a 233/427: Flesh out the changes in the README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ed77eac846 237/427: Add string prepared statements., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 847196cafa 226/427: Set tty to raw in psql., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3e5ce21b0d 242/427: Tweak the new implementation notes., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a459708684 244/427: Move tests into their own directory., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4db068920d 247/427: Provide MySQL front-end., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql dce6736e04 249/427: Oops, add new MySQL module to the Makefile., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql fcba876d0e 251/427: Solve the tty (pty) issue in MySQL., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql fb0e2d5423 256/427: Fix typecase typo., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a6e859f1b5 260/427: Normalize darwin OS., ELPA Syncer, 2022/12/13