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

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

[nongnu] elpa/emacsql 1ad58cd68d 108/427: Allow substatement in IN opera


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql 1ad58cd68d 108/427: Allow substatement in IN operator.
Date: Tue, 13 Dec 2022 02:59:33 -0500 (EST)

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

    Allow substatement in IN operator.
---
 emacsql.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/emacsql.el b/emacsql.el
index 401dc74506..e946a29422 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -466,9 +466,14 @@ definitions for return from a `emacsql-defexpander'."
                (2 (format "%s - %s" (recur 0) (recur 1)))))
             ;; IN special case
             ((in)
-             (if (= 2 (length args))
-                 (format "%s IN %s" (recur 0)
-                         (var (nth 1 args) :vector))))))))))
+             (cl-case (length args)
+               (1 (error "Wrong number of operands for %s" op))
+               (2 (format "%s IN %s" (recur 0) (var (nth 1 args) :vector)))
+               (otherwise
+                (let ((subsql (cl-coerce (cdr args) 'vector)))
+                  (format "%s IN %s"
+                          (recur 0)
+                          (combine (emacsql-expand subsql :sub)))))))))))))
 
 ;; SQL Expansion Functions:
 



reply via email to

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