mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-05 10:56:10 +02:00
Further simplifications from stassats.
This commit is contained in:
parent
f922392341
commit
b3a09a20e3
@ -197,17 +197,20 @@
|
||||
:when (member extension extensions :test #'string-equal)
|
||||
:return type))))))
|
||||
|
||||
(defvar *parse-rule-for-source-types*
|
||||
'(:csv csv-file-source
|
||||
:fixed fixed-file-source
|
||||
:dbf dbf-file-source
|
||||
:ixf ixf-file-source
|
||||
:sqlite sqlite-uri
|
||||
:pgsql pgsql-uri
|
||||
:mysql mysql-uri
|
||||
:mssql mssql-uri)
|
||||
"A plist to associate source type and its source parsing rule.")
|
||||
|
||||
(defun parse-source-string-for-type (type source-string)
|
||||
"use the parse rules as per xxx-source rules"
|
||||
(case type
|
||||
(:csv (parse 'csv-file-source source-string))
|
||||
(:fixed (parse 'fixed-file-source source-string))
|
||||
(:dbf (parse 'dbf-file-source source-string))
|
||||
(:ixf (parse 'ixf-file-source source-string))
|
||||
(:sqlite (parse 'sqlite-uri source-string))
|
||||
(:postgresql (parse 'pgsql-uri source-string))
|
||||
(:mysql (parse 'mysql-uri source-string))
|
||||
(:mssql (parse 'mssql-uri source-string))))
|
||||
(parse (getf *parse-rule-for-source-types* type) source-string))
|
||||
|
||||
(defrule source-uri (or csv-uri
|
||||
fixed-uri
|
||||
|
||||
@ -116,8 +116,7 @@
|
||||
(multiple-value-bind (res secs)
|
||||
(timing
|
||||
(handler-case (pgsql-execute sql)
|
||||
(cl-postgres:database-error (e)
|
||||
(declare (ignore e)) ; a log has already been printed
|
||||
(cl-postgres:database-error ()
|
||||
(pgstate-incf state label :errs 1 :rows (- count)))))
|
||||
(declare (ignore res))
|
||||
(pgstate-incf state label :read count :rows count :secs secs)))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user