[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql 223db2d397 141/427: Add quote operator.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql 223db2d397 141/427: Add quote operator. |
Date: |
Tue, 13 Dec 2022 02:59:36 -0500 (EST) |
branch: elpa/emacsql
commit 223db2d39789c67c15a3002516b76c9670114cb6
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@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)
- [nongnu] elpa/emacsql ee2877dab0 106/427: Clearer error message from escape identifier., (continued)
- [nongnu] elpa/emacsql ee2877dab0 106/427: Clearer error message from escape identifier., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql e9b77b4774 112/427: Add a test for CREATE TABLE., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 652847dbf5 110/427: Allow memoization cache to be nil (for development)., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ff4c59a2a7 113/427: Fix cl-lib mistake., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f794d4d38f 116/427: Allow for selected columns in :insert-into., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql cefe1ec014 121/427: Add emacsql-sqlite3-unavailable-p., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql b2d83c6477 123/427: Fix up ORDER BY, drop :ascending-by., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f52af86b05 124/427: Break apart and organize compilation tests., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 0bff8ccc34 126/427: Fix up README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a362a97c98 136/427: Add README section on foreign keys., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 223db2d397 141/427: Add quote operator.,
ELPA Syncer <=
- [nongnu] elpa/emacsql 8951084b40 143/427: Add variable escaping., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 19a65f390e 147/427: Add ignored features section to README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 530b0ad98c 151/427: Allow arbitrary sub-statements., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3012f5b725 154/427: Fix typo., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 301e2ff4b6 175/427: Drop "simple" from helper method names., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 578a71d2d8 157/427: Re-order some definitions to group them., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 935cca89a9 176/427: Add updated information about Windows., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql b3aea1e6af 055/427: Oops, fix >= back., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c4396ec5e6 057/427: Fix a bunch of warnings., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql e9fbc4a913 061/427: Fill out a Makefile., ELPA Syncer, 2022/12/13