branch: elpa/emacsql commit 223db2d39789c67c15a3002516b76c9670114cb6 Author: Christopher Wellons <well...@nullprogram.com> Commit: Christopher Wellons <well...@nullprogram.com>
Add quote operator. --- README.md | 11 +++++++++++ emacsql.el | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 8c554d7a9b..f680060849 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,17 @@ With `glob` and `like` keep in mind that they're matching the *printed* representations of these values, even if the value is a string. +Inside expressions, Emacsql cannot tell the difference between symbol +literals and column references. If you're talking about the symbol +itself, just quote it as you would in normal Elisp. Note that this +does not "escape" `$n` variables: it just means the argument gets +quoted. + +```el +[... :where (= category 'hiking)] +(emacsql db [... :where (= category '$1)] 'hiking) +``` + The `||` concatenation operator is unsupported because concatenating printed representations breaks an important constraint: all values must remain readable within SQLite. diff --git a/emacsql.el b/emacsql.el index 158a23e439..9292a0b730 100644 --- a/emacsql.el +++ b/emacsql.el @@ -531,6 +531,10 @@ definitions for return from a `emacsql-defexpander'." (cl-ecase (length args) (1 (format "-(%s)" (recur 0))) (2 (format "%s - %s" (recur 0) (recur 1))))) + ;; quote special case + ((quote) + (cl-ecase (length args) + (1 (var (nth 0 args) :value)))) ;; IN special case ((in) (cl-case (length args)