Hi,
I propose to add new query formats:
diff --git a/doc/postmodern.html b/doc/postmodern.html
index 3691ae8..9ac466f 100644
--- a/doc/postmodern.html
+++ b/doc/postmodern.html
@@ -202,6 +202,10 @@
row.</td></tr>
<tr><td><code>:list</code>, <code>:row</code></td><td>Return a
single row as a list.</td></tr>
+ <tr><td><code>:plists</code></td><td>Return a list of plists which
map column
+ names to values,with the names represented as
+ keywords.</td></tr>
+ <tr><td><code>:plist</code></td><td>Return a single row as an
plist.</td></tr>
<tr><td><code>:alists</code></td><td>Return a list of alists which
map column
names to values,with the names represented as
keywords.</td></tr>
diff --git a/postmodern/query.lisp b/postmodern/query.lisp
index 3e5bfa5..921d03d 100644
--- a/postmodern/query.lisp
+++ b/postmodern/query.lisp
@@ -9,6 +9,15 @@
:for symbol :in symbols
:collect (cons symbol (next-field field))))))
+;; Like symbol-alist-row-reader, but return plist
+(def-row-reader symbol-plist-row-reader (fields)
+ (let ((symbols (map 'list (lambda (desc) (from-sql-name (field-name
desc))) fields)))
+ (loop :while (next-row)
+ :collect (loop :for field :across fields
+ :for symbol :in symbols
+ :collect symbol
+ :collect (next-field field)))))
+
;; A row-reader for reading only a single column, and returning a list
;; of single values.
(def-row-reader column-row-reader (fields)
@@ -22,6 +31,8 @@
(:list list-row-reader t)
(:rows list-row-reader nil)
(:row list-row-reader t)
+ (:plists symbol-plist-row-reader nil)
+ (:plist symbol-plist-row-reader t)
(:alists symbol-alist-row-reader nil)
(:alist symbol-alist-row-reader t)
(:str-alists alist-row-reader nil)
Moskvitin Andrey