[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql cc92c154ee 205/427: Disallow nil as an identifier.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql cc92c154ee 205/427: Disallow nil as an identifier. |
Date: |
Tue, 13 Dec 2022 02:59:42 -0500 (EST) |
branch: elpa/emacsql
commit cc92c154ee34b8390aa29d7a9b7cd51e996cc457
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Disallow nil as an identifier.
---
emacsql-compiler.el | 7 ++++---
emacsql-tests.el | 1 +
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/emacsql-compiler.el b/emacsql-compiler.el
index 28bd574e35..5a226579fc 100644
--- a/emacsql-compiler.el
+++ b/emacsql-compiler.el
@@ -40,7 +40,8 @@
(keyword (substring (symbol-name identifier) 1))
(otherwise (format "%S" identifier))))
(forbidden "[]\000-\040!\"#%&'()*+,./;<=>?@[\\^`{|}~\177]"))
- (when (or (string-match-p forbidden string)
+ (when (or (null identifier)
+ (string-match-p forbidden string)
(string-match-p "^[0-9$]" string))
(emacsql-error "Invalid Emacsql identifier: %S" identifier))
(setf string (replace-regexp-in-string ":" "." string))
@@ -137,7 +138,7 @@ a list of (<string> [arg-pos] ...)."
(:value (emacsql-escape-value thing))
(:vector (emacsql-escape-vector thing))
(:schema (car (emacsql--schema-to-string thing)))
- (:auto (if (symbolp thing)
+ (:auto (if (and thing (symbolp thing))
(emacsql-escape-identifier thing)
(emacsql-escape-value thing)))
(otherwise
@@ -178,7 +179,7 @@ KIND should be :value or :identifier."
(cl-case kind
((:identifier :value :vector) (emacsql-escape-format thing kind))
(:auto (emacsql-escape-format
- thing (if (symbolp thing) :identifier :value)))
+ thing (if (and thing (symbolp thing)) :identifier :value)))
(otherwise (emacsql-error "Invalid var type: %S" kind))))))
(defun emacsql--vars-combine (expanded)
diff --git a/emacsql-tests.el b/emacsql-tests.el
index bf36d02881..e1058e1814 100644
--- a/emacsql-tests.el
+++ b/emacsql-tests.el
@@ -13,6 +13,7 @@
(should-error (emacsql-escape-identifier "a b"))
(should-error (emacsql-escape-identifier '$foo))
(should-error (emacsql-escape-identifier 10))
+ (should-error (emacsql-escape-identifier nil))
(should (string= (emacsql-escape-identifier 'person-id) "person_id"))
(should (string= (emacsql-escape-identifier
'people:person-id) "people.person_id"))
- [nongnu] elpa/emacsql d21cc86540 188/427: Add lexical binding to tests., (continued)
- [nongnu] elpa/emacsql d21cc86540 188/427: Add lexical binding to tests., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3d556608ef 394/427: emacsql-mysql: Abort if mysql cannot be found, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 568e663032 193/427: Fold dashes into underscores in identifiers., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c85ab1f7b4 194/427: Enable foreign keys in SQLite by default., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f51bb4bfaf 195/427: Allow foreign key specifications within columns., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c4abd187a3 196/427: Remove junk file., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3dfd0d4b8c 199/427: Fix missing argument typo., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 7341144e49 201/427: Fix ordering bug in emacsql--var-vars., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql d8d4bf4b98 202/427: Add emacsql-with-transaction macro., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql dc178532e5 203/427: Add emacsql-with-bind., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql cc92c154ee 205/427: Disallow nil as an identifier.,
ELPA Syncer <=
- [nongnu] elpa/emacsql 75c0c4aeb7 204/427: Tweak emacsql-with-bind macro., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3f38b357c3 206/427: Detect empty SQL vectors (better error messages)., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ad24b1c508 208/427: Add JOIN syntax., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql fe2eef212c 210/427: Fix header typo., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 89654ad76b 211/427: Add identifier note., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 543189295d 215/427: Drop the pointless autoloads., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3127283cd1 218/427: Clean up middleware a bit., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql cf16cdb2f8 217/427: Add a special characters test., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 2db4a84598 225/427: Allow os tuples to be specified as an env var., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ba2fac7701 228/427: Update the README., ELPA Syncer, 2022/12/13