From fa0cd19178ce76b6b7e7292bf4ce012303c95c1f Mon Sep 17 00:00:00 2001 From: Russ Tyndall Date: Mon, 18 Jan 2010 17:11:32 -0500 Subject: [PATCH] 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) --- db-odbc/odbc-api.lisp | 8 +++++--- db-odbc/odbc-dbi.lisp | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) 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) -- 2.34.1