From 9cbc6d3a7769dcff71f4c30cf379ea8bd3539cdb Mon Sep 17 00:00:00 2001 From: Russ Tyndall Date: Wed, 22 Jul 2009 16:05:15 -0400 Subject: [PATCH] fixed canonicalize-type-list so that it behaved even remotely sanely prev: 8ef3f8059e39bf66e8afddc2cbcd97c7c0710c7c --- .../postgresql-socket-sql.lisp | 38 +++++-------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/db-postgresql-socket/postgresql-socket-sql.lisp b/db-postgresql-socket/postgresql-socket-sql.lisp index 9183ca4..352198a 100644 --- a/db-postgresql-socket/postgresql-socket-sql.lisp +++ b/db-postgresql-socket/postgresql-socket-sql.lisp @@ -70,35 +70,17 @@ nil))))) (defun canonicalize-type-list (types auto-list) - "Ensure a field type list meets expectations. -Duplicated from clsql-uffi package so that this interface -doesn't depend on UFFI." - (let ((length-types (length types)) - (new-types '())) + "Ensure a field type list meets expectations. Essentially if we get a + generic term for a type that our auto typer pulls a better type for, + use it instead" + (let ((length-types (length types))) (loop for i from 0 below (length auto-list) - do - (if (>= i length-types) - (push t new-types) ;; types is shorted than num-fields - (push - (case (nth i types) - (:int - (case (nth i auto-list) - (:int32 - :int32) - (:int64 - :int64) - (t - t))) - (:double - (case (nth i auto-list) - (:double - :double) - (t - t))) - (t - t)) - new-types))) - (nreverse new-types))) + for auto = (nth i auto-list) + collect + (if (or (>= i length-types) + (member (nth i types) (list T :int :double))) + auto + (nth i types))))) (defun convert-to-clsql-warning (database condition) -- 2.34.1