branch: elpa/emacsql commit 1a84c983cf5115a95389d4a3ad8683b5393fea89 Author: Christopher Wellons <well...@nullprogram.com> Commit: Christopher Wellons <well...@nullprogram.com>
No named results by default. --- README.md | 2 +- emacsql.el | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 901e91926d..1cf833ea4b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Requires Emacs 24 or later. ;; The high-level SELECT interface is a work in progress. (emacsql-select-raw db (concat "SELECT name, id FROM ':employees' " "WHERE salary > 60000;")) -;; => (((name . "Susan") (id . 1001))) +;; => (("Susan" 1001)) ``` ## Limitations diff --git a/emacsql.el b/emacsql.el index 35834fb399..b9778ea84f 100644 --- a/emacsql.el +++ b/emacsql.el @@ -39,7 +39,7 @@ ;; (emacsql-select-raw db (concat "SELECT name, id FROM ':employees' " ;; "WHERE salary > 60000;")) -;; ;; => (((name . "Susan") (id . 1001))) +;; ;; => (("Susan" 1001)) ;; Limitations: @@ -154,9 +154,9 @@ buffer. This is for debugging purposes." (buffer-substring (- (point-max) 2) (point-max))))))) -(defun emacsql--parse (emacsql &rest flatten) +(defun emacsql--parse (emacsql &rest named) "Parse a query result into an s-expression. -If FLATTEN is non-nil, don't include column names." +If NAMED is non-nil, don't include column names." (with-current-buffer (emacsql-buffer emacsql) (let ((standard-input (current-buffer))) (setf (point) (point-min)) @@ -164,8 +164,8 @@ If FLATTEN is non-nil, don't include column names." for name = (read) do (forward-char 3) for value = (read) - when flatten collect value into row - else collect (cons name value) into row + when named collect (cons name value) into row + else collect value into row do (forward-char) when (or (looking-at "\n") (looking-at "#")) collect row into rows and do (setf row ())