[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql a6dbb52a3c 009/427: Add flatten option.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql a6dbb52a3c 009/427: Add flatten option. |
Date: |
Tue, 13 Dec 2022 02:59:23 -0500 (EST) |
branch: elpa/emacsql
commit a6dbb52a3ce16a2ff4630f7f3806ad8d6cd66570
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Add flatten option.
---
emacsql.el | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/emacsql.el b/emacsql.el
index ed81295794..07f1404a8a 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -154,14 +154,18 @@ buffer. This is for debugging purposes."
(buffer-substring
(- (point-max) 2) (point-max)))))))
-(defun emacsql--parse (emacsql)
- "Parse a query result into an s-expression."
+(defun emacsql--parse (emacsql &rest flatten)
+ "Parse a query result into an s-expression.
+If FLATTEN is non-nil, don't include column names."
(with-current-buffer (emacsql-buffer emacsql)
(let ((standard-input (current-buffer)))
(setf (point) (point-min))
(cl-loop until (looking-at "#")
- for (name _= value) = (list (read) (read) (read))
- collect (cons name value) into row
+ for name = (read)
+ do (forward-char 3)
+ for value = (read)
+ when flatten collect value into row
+ else collect (cons name value) into row
do (forward-char)
when (or (looking-at "\n") (looking-at "#"))
collect row into rows and do (setf row ())
- [nongnu] elpa/emacsql ccfafd7703 012/427: Always quote non-number values., (continued)
- [nongnu] elpa/emacsql ccfafd7703 012/427: Always quote non-number values., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1074113f03 016/427: Add readability note., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 727f3c8566 022/427: Make nil correspond to NULL., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f8d9511d1d 025/427: Tweak README limitations paragraph., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 2f0a9457a4 029/427: Drop non-idiomatic :else., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4f6b524b9f 026/427: Rename spec to schema., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 208885e264 031/427: Add testing to schema handling., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql abe43b3381 043/427: Add :where test., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4a89bfaf44 044/427: Use a macro to greatly simplify expanders., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql eb10ddcdba 004/427: Error-free reaping since it's automatic., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a6dbb52a3c 009/427: Add flatten option.,
ELPA Syncer <=
- [nongnu] elpa/emacsql 2053a15b21 010/427: Add Emacs requirement note., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 961c689269 011/427: Rename information to constraints., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c7a8ef0908 015/427: Rename every emacsql argument to conn., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql d083cbb70e 017/427: Add in-memory database support., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 9091fe8df5 019/427: Rename sqlite-program-name into namespace., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 9c3293c57e 020/427: Add a docstring to emacsql struct., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 178a31d5ca 024/427: Lock in the coding system., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 85076dfe0f 027/427: Flesh out example more., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c9854331c0 028/427: Add (un)license header., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 896bb7ce52 035/427: Start adding SQL expanders., ELPA Syncer, 2022/12/13