emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/emacsql 1e9857ccc4 103/427: Allow variables inside vectors


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql 1e9857ccc4 103/427: Allow variables inside vectors.
Date: Tue, 13 Dec 2022 02:59:32 -0500 (EST)

branch: elpa/emacsql
commit 1e9857ccc450cf339ea6dd4b144e57e219c3be9b
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>

    Allow variables inside vectors.
---
 emacsql.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/emacsql.el b/emacsql.el
index 4e3875a12b..6f7596648b 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -413,6 +413,17 @@ definitions for return from a `emacsql-defexpander'."
 (declare-function combine nil (expanded))
 (declare-function var nil (thing kind))
 
+(defun emacsql--vector (vector)
+  "Expand VECTOR, making variables as needed."
+  (emacsql-with-vars ""
+    (cl-etypecase vector
+      (symbol
+       (var vector :vector))
+      (list
+       (mapconcat (lambda (v) (combine (emacsql--vector v))) vector ", "))
+      (vector
+       (format "(%s)" (mapconcat (lambda (x) (var x :value)) vector ", "))))))
+
 (defun emacsql--expr (expr)
   "Expand EXPR recursively."
   (emacsql-with-vars ""
@@ -498,7 +509,7 @@ definitions for return from a `emacsql-defexpander'."
 
 (emacsql-defexpander :values (values)
   (emacsql-with-vars "VALUES "
-    (var values :vector)))
+    (combine (emacsql--vector values))))
 
 (emacsql-defexpander :update (table)
   (emacsql-with-vars "UPDATE "



reply via email to

[Prev in Thread] Current Thread [Next in Thread]