From: Nathan Bird Date: Mon, 20 Jul 2009 20:18:12 +0000 (-0400) Subject: Guard against already converted values in read-sql-value X-Git-Tag: v5.0.5~8^2^2~10 X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=ce5b60109610a07d48868a3f758fb8c7d362906d Guard against already converted values in read-sql-value Sometimes select has already done the conversion to native lisp format, we then don't need to do anything here, but was causing an error as read-from-string on a value that isn't a string isn't allowed. --- diff --git a/sql/oodml.lisp b/sql/oodml.lisp index 634acc8..9dc7b0f 100644 --- a/sql/oodml.lisp +++ b/sql/oodml.lisp @@ -580,8 +580,12 @@ (format nil "~F" val)))) (defmethod read-sql-value (val type database db-type) - (declare (ignore type database db-type)) - (read-from-string val)) + (declare (ignore database db-type)) + (cond + ((null type) val) ;;we have no desired type, just give the value + ((typep val type) val) ;;check that it hasn't already been converted. + ((typep val 'string) (read-from-string val)) ;;maybe read will just take care of it? + (T (error "Unable to read-sql-value ~a as type ~a" val type)))) (defmethod read-sql-value (val (type (eql 'string)) database db-type) (declare (ignore database db-type))