branch: elpa/emacsql commit aa9283ca0a638fa53625743624e8e74b8cf6fbae Author: Christopher Wellons <well...@nullprogram.com> Commit: Christopher Wellons <well...@nullprogram.com>
Allow sub-selects with :from. --- README.md | 2 ++ emacsql.el | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e3beb5d452..d936c94f92 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,8 @@ Provides `FROM`. ```el [... :from employees] +[... :from [employees accounts]] +[... :from (:select ...)] ``` #### :where `<expr>` diff --git a/emacsql.el b/emacsql.el index 91808ae202..c38af94b21 100644 --- a/emacsql.el +++ b/emacsql.el @@ -535,7 +535,10 @@ definitions for return from a `emacsql-defexpander'." (emacsql-defexpander :from (table) "Expands to the FROM keyword." (emacsql-with-vars "FROM " - (var table :identifier))) + (cl-etypecase table + (vector (idents table)) + (symbol (var table :identifier)) + (list (combine (emacsql-expand table :subsql-p)))))) (emacsql-defexpander :replace () (list "REPLACE"))