From b3a09a20e3256a042b56b3376a4c34491f3cad46 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Fri, 26 Dec 2014 22:17:04 +0100 Subject: [PATCH] Further simplifications from stassats. --- src/parsers/command-parser.lisp | 21 ++++++++++++--------- src/pgsql/queries.lisp | 3 +-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/parsers/command-parser.lisp b/src/parsers/command-parser.lisp index 766048b..54ec7ce 100644 --- a/src/parsers/command-parser.lisp +++ b/src/parsers/command-parser.lisp @@ -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 diff --git a/src/pgsql/queries.lisp b/src/pgsql/queries.lisp index bba1d66..74a2c32 100644 --- a/src/pgsql/queries.lisp +++ b/src/pgsql/queries.lisp @@ -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)))