mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-05 02:46:10 +02:00
Handle "ragged right" fixed width files, fix #82.
This commit is contained in:
parent
9ad98c5c2a
commit
88eba90776
@ -34,9 +34,12 @@
|
||||
|
||||
(defun parse-row (fixed-cols-specs line)
|
||||
"Parse a single line of FIXED input file and return a row of columns."
|
||||
(loop :for opts :in fixed-cols-specs
|
||||
(loop :with len := (length line)
|
||||
:for opts :in fixed-cols-specs
|
||||
:collect (destructuring-bind (&key start length &allow-other-keys) opts
|
||||
(subseq line start (+ start length)))))
|
||||
(let ((end (+ start length)))
|
||||
(when (<= end len)
|
||||
(subseq line start end))))))
|
||||
|
||||
(defmethod map-rows ((fixed copy-fixed) &key process-row-fn)
|
||||
"Load data from a text file in Fixed Columns format.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user