From: Russ Tyndall Date: Mon, 18 Jan 2010 22:11:32 +0000 (-0500) Subject: made odbc read (from c) decimals and numerics as doubles instead of strings, in prepa... X-Git-Url: http://git.kpe.io/?a=commitdiff_plain;h=fa0cd19178ce76b6b7e7292bf4ce012303c95c1f;p=clsql.git made odbc read (from c) decimals and numerics as doubles instead of strings, in preparation of making it handle rational numbers re ADWolf:#614 (4) --- diff --git a/db-odbc/odbc-api.lisp b/db-odbc/odbc-api.lisp index 49a6e1f..8b9788d 100644 --- a/db-odbc/odbc-api.lisp +++ b/db-odbc/odbc-api.lisp @@ -678,9 +678,11 @@ as possible second argument) to the desired representation of date/time/timestam (#.$SQL_SMALLINT (get-cast-short data-ptr)) ;; ?? (#.$SQL_INTEGER (get-cast-int data-ptr)) (#.$SQL_BIGINT (get-cast-big data-ptr)) - (#.$SQL_DECIMAL - (let ((*read-base* 10)) - (read-from-string (get-cast-foreign-string data-ptr)))) + ((#.$SQL_DECIMAL #.$SQL_NUMERIC) + (let* ((*read-base* 10) + (*read-default-float-format* 'double-float) + (str (get-cast-foreign-string data-ptr))) + (read-from-string str))) (#.$SQL_BIT (get-cast-byte data-ptr)) (t (case c-type diff --git a/db-odbc/odbc-dbi.lisp b/db-odbc/odbc-dbi.lisp index 86929d7..0b88ee2 100644 --- a/db-odbc/odbc-dbi.lisp +++ b/db-odbc/odbc-dbi.lisp @@ -465,6 +465,10 @@ This makes the functions db-execute-command and db-query thread safe." (#.odbc::$SQL_C_SSHORT :short) (#.odbc::$SQL_C_STINYINT :short) (#.odbc::$SQL_C_SBIGINT #.odbc::$ODBC-BIG-TYPE) + (#.odbc::$SQL_C_CHAR + (or (case (aref column-sql-types i) + (#.odbc::$SQL_NUMERIC :double)) + T)) (t t))) (t t))))) query)