From 2577308ad690753e63dbfabe9681d55f5ded202e Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Thu, 26 Jun 2014 02:08:49 +0200 Subject: [PATCH] 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. --- src/sources/sources.lisp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/sources/sources.lisp b/src/sources/sources.lisp index 389b2f0..3d7164c 100644 --- a/src/sources/sources.lisp +++ b/src/sources/sources.lisp @@ -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))))