1;;;
2;;; Common methods implementations, default behaviour.
3;;;
4
5(in-package #:pgloader.sources)
6
7(defmethod data-is-preformatted-p ((copy copy))
8  "By default, data is not preformatted."
9  nil)
10
11(defmethod preprocess-row ((copy copy))
12  "The default preprocessing of raw data is to do nothing."
13  nil)
14
15(defmethod copy-column-list ((copy copy))
16  "Default column list is an empty list."
17  nil)
18
19(defmethod cleanup ((copy db-copy) (catalog catalog) &key materialize-views)
20  "In case anything wrong happens at `prepare-pgsql-database' step, this
21  function will be called to clean-up the mess left behind, if any."
22  (declare (ignorable materialize-views))
23  t)
24
25(defmethod instanciate-table-copy-object ((copy db-copy) (table table))
26  "Create an new instance for copying TABLE data."
27  (let* ((fields     (table-field-list table))
28         (columns    (table-column-list table))
29         (transforms (mapcar #'column-transform columns)))
30    (make-instance (class-of copy)
31                   :source-db  (clone-connection (source-db copy))
32                   :target-db  (clone-connection (target-db copy))
33                   :source     table
34                   :target     table
35                   :fields     fields
36                   :columns    columns
37                   :transforms transforms)))
38