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

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

[nongnu] elpa/emacsql 2faed63b20 107/427: Prime emacsql-expand for subst


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql 2faed63b20 107/427: Prime emacsql-expand for substatements.
Date: Tue, 13 Dec 2022 02:59:33 -0500 (EST)

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

    Prime emacsql-expand for substatements.
---
 emacsql.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/emacsql.el b/emacsql.el
index 8c14f9f392..401dc74506 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -311,7 +311,7 @@ a list of (<string> [arg-pos] ...)."
   (declare (indent 2))
   `(emacsql-add-expander ,keyword ,(length args) (lambda ,args ,@body)))
 
-(defun emacsql-expand (sql)
+(defun emacsql-expand (sql &optional subsql-p)
   "Expand SQL into a SQL-consumable string, with variables."
   (let* ((cache emacsql-expander-cache)
          (cached (and cache (gethash sql cache))))
@@ -325,7 +325,9 @@ a list of (<string> [arg-pos] ...)."
                  else do (error "Unrecognized keyword %s" keyword)
                  do (setf items (cl-subseq items arity))
                  finally
-                 (let ((string (concat (mapconcat #'car parts " ") ";"))
+                 (let ((string (concat (if subsql-p "(" "")
+                                       (mapconcat #'car parts " ")
+                                       (if subsql-p ")" ";")))
                        (vars (apply #'nconc (mapcar #'cdr parts))))
                    (cl-return (setf (gethash sql cache)
                                     (cons string vars))))))))



reply via email to

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