Fix compilation warnings when not using before/after load constructs.

This commit is contained in:
Dimitri Fontaine 2013-10-11 11:56:12 +02:00
parent 1cf15b0f6f
commit 38d5ad6829

View File

@ -1230,44 +1230,45 @@ Here's a quick description of the format we're parsing here:
&allow-other-keys) &allow-other-keys)
pg-db-uri pg-db-uri
`(lambda () `(lambda ()
(let* ((state-before (when ',before (pgloader.utils:make-pgstate))) (let* ((state-before ,(when before `(pgloader.utils:make-pgstate)))
(summary (null *state*)) (summary (null *state*))
(*state* (or *state* (pgloader.utils:make-pgstate))) (*state* (or *state* (pgloader.utils:make-pgstate)))
(state-after (when ',after (pgloader.utils:make-pgstate))) (state-after ,(when after `(pgloader.utils:make-pgstate)))
(*pgconn-host* ,host) (*pgconn-host* ,host)
(*pgconn-port* ,port) (*pgconn-port* ,port)
(*pgconn-user* ,user) (*pgconn-user* ,user)
(*pgconn-pass* ,password)) (*pgconn-pass* ,password))
;; before block (progn
,(when before ;; before block
`(with-stats-collection (,dbname "before load" :state state-before) ,(when before
(with-pgsql-transaction (,dbname) `(with-stats-collection (,dbname "before load" :state state-before)
(loop for command in ',before (with-pgsql-transaction (,dbname)
do (loop for command in ',before
(log-message :notice command) do
(pgsql-execute command :client-min-messages :error))))) (log-message :notice command)
(pgsql-execute command :client-min-messages :error)))))
(pgloader.csv:copy-from-file ,dbname (pgloader.csv:copy-from-file ,dbname
,table-name ,table-name
',source ',source
:encoding ,encoding :encoding ,encoding
:fields ',fields :fields ',fields
:columns ',columns :columns ',columns
,@options) ,@options)
;; finally block ;; after block
,(when after ,(when after
`(with-stats-collection (,dbname "after load" :state state-after) `(with-stats-collection (,dbname "after load" :state state-after)
(with-pgsql-transaction (,dbname) (with-pgsql-transaction (,dbname)
(loop for command in ',after (loop for command in ',after
do do
(log-message :notice command) (log-message :notice command)
(pgsql-execute command :client-min-messages :error))))) (pgsql-execute command :client-min-messages :error)))))
;; reporting ;; reporting
(when summary (when summary
(report-full-summary *state* state-before state-after (report-full-summary *state* state-before state-after
"Total import time")))))))) "Total import time")))))))))
;;; ;;;
@ -1444,9 +1445,6 @@ Here's a quick description of the format we're parsing here:
(parse-commands-from-file source) (parse-commands-from-file source)
(parse-commands source))))))) (parse-commands source)))))))
;; Start the logger
(start-logger)
;; run the commands ;; run the commands
(loop for func in funcs do (funcall func)))) (loop for func in funcs do (funcall func))))