In ODBC when reading data in chunks with a specified out-length, use that as
[clsql.git] / db-odbc / odbc-api.lisp
index 50ef4432d3485df1f6792b2cb01041c8a4e39106..aefd83820984cb5cee685d2df0eec26d0d572f30 100644 (file)
@@ -6,8 +6,6 @@
 ;;;; Purpose:  Low-level ODBC API using UFFI
 ;;;; Authors:  Kevin M. Rosenberg and Paul Meurer
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2004 by Kevin M. Rosenberg
 ;;;; and Copyright (C) Paul Meurer 1999 - 2001. All rights reserved.
 ;;;;
@@ -26,10 +24,11 @@ May be locally bound to something else if a certain type is necessary.")
 (defvar *binary-format* :unsigned-byte-vector)
 (defvar *time-conversion-function*
     (lambda (universal-time &optional fraction)
-      (declare (ignore fraction))
-      (clsql-sys:format-time
-       nil (clsql-sys:utime->time universal-time)
-       :format :iso)
+       (let ((time (clsql-sys:utime->time universal-time)))
+        (setf time (clsql-sys:time+
+                    time
+                    (clsql-sys:make-duration :usec (/ fraction 1000))))
+        (clsql-sys:format-time nil time :format :iso))
       #+ignore
       universal-time)
    "Bound to a function that converts from a Lisp universal time fixnum (and a fractional
@@ -913,10 +912,7 @@ as possible second argument) to the desired representation of date/time/timestam
                                  (error 'clsql:sql-database-error :message "wrong type. preliminary."))
                             while
                             (and (= res $SQL_SUCCESS_WITH_INFO)
-                                 #+ingore(eq (sql-state +null-handle-ptr+ +null-handle-ptr+ hstmt)
-                                             $sql-data-truncated)
-                                 (equal (sql-state +null-handle-ptr+ +null-handle-ptr+ hstmt)
-                                        "01004"))
+                                 (> out-len +max-precision+))
                             do (setf res (%sql-get-data hstmt column-nr c-type data-ptr
                                                         +max-precision+ out-len-ptr)
                                      out-len (deref-pointer out-len-ptr #.$ODBC-LONG-TYPE)))