Ensure field level processing is happening in all cases.

When using both field level specifications and transformation functions,
the transformation needs to happen on the result of the field processing
rather than on the raw field.

Fixes #92.
This commit is contained in:
Dimitri Fontaine 2014-06-26 02:08:49 +02:00
parent ab75e6c626
commit 2577308ad6

View File

@ -272,6 +272,15 @@
(if fields
(mapcar (function field-name-as-symbol) fields)
(mapcar (function field-name-as-symbol) columns)))
(values
;; make sure we apply fields level processing before
;; we pass in the processed field values to the
;; transformation functions, if any (null if blanks)
(loop for field-name in args
collect (list
field-name
`(funcall ,(field-process-null-fn field-name)
,field-name))))
(newrow
(loop for (name type fn) in columns
collect
@ -284,7 +293,9 @@
(declare (optimize speed) (type list row))
(destructuring-bind (&optional ,@args &rest extra) row
(declare (ignorable ,@args) (ignore extra))
(vector ,@newrow))))))))
(let ,values
(declare (ignorable ,@args))
(vector ,@newrow)))))))))
;; allow for some debugging
(if compile (compile nil projection) projection))))