summarylogtreecommitdiffstats
path: root/0001-Adapt-to-the-new-cl-ixf-API.patch
blob: bf953dd5b4238f8ee283b76d968da8caa1ec15b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From a195ac6dd48cb8235b58a5a95eabb5dfb676d72f Mon Sep 17 00:00:00 2001
From: Dimitri Fontaine <dim@tapoueh.org>
Date: Sat, 12 Sep 2015 00:19:02 +0200
Subject: [PATCH] Adapt to the new cl-ixf API.

This allows fixing bugs in processing the IXF files, which pgloader
directly benefits from.
---
 src/sources/ixf/ixf-schema.lisp |  9 ++++-----
 src/sources/ixf/ixf.lisp        | 12 ++++++------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/sources/ixf/ixf-schema.lisp b/src/sources/ixf/ixf-schema.lisp
index 946bce5..5f95db8 100644
--- a/src/sources/ixf/ixf-schema.lisp
+++ b/src/sources/ixf/ixf-schema.lisp
@@ -67,8 +67,7 @@
 
 (defun list-all-columns (ixf-stream table-name)
   "Return the list of columns for the given IXF-FILE-NAME."
-  (let ((ixf:*ixf-stream* ixf-stream))
-    (let ((ixf (ixf:read-headers)))
-      (list (cons table-name
-                  (coerce (ixf:ixf-table-columns (ixf:ixf-file-table ixf))
-                          'list))))))
+  (ixf:with-ixf-stream (ixf ixf-stream)
+    (list (cons table-name
+                (coerce (ixf:ixf-table-columns (ixf:ixf-file-table ixf))
+                        'list)))))
diff --git a/src/sources/ixf/ixf.lisp b/src/sources/ixf/ixf.lisp
index e481260..8872666 100644
--- a/src/sources/ixf/ixf.lisp
+++ b/src/sources/ixf/ixf.lisp
@@ -59,12 +59,12 @@
   "Extract IXF data and call PROCESS-ROW-FN function with a single
    argument (a list of column values) for each row."
   (with-connection (conn (source-db copy-ixf))
-    (let ((ixf:*ixf-stream* (conn-handle conn)))
-      (let ((ixf    (ixf:read-headers))
-            (row-fn (lambda (row)
-                      (pgstate-incf *state* (target copy-ixf) :read 1)
-                      (funcall process-row-fn row))))
-        (ixf:map-data ixf row-fn)))))
+    (let ((ixf    (ixf:make-ixf-file :stream (conn-handle conn)))
+          (row-fn (lambda (row)
+                    (pgstate-incf *state* (target copy-ixf) :read 1)
+                    (funcall process-row-fn row))))
+      (ixf:read-headers ixf)
+      (ixf:map-data ixf row-fn))))
 
 (defmethod copy-to-queue ((ixf copy-ixf) queue)
   "Copy data from IXF file FILENAME into queue DATAQ"
-- 
2.5.2