Index: combined/src/odbc/odbc-functions.lisp
===================================================================
--- combined/src/odbc/odbc-functions.lisp	(revision combined,2.1.1)
+++ combined/src/odbc/odbc-functions.lisp	(revision combined,2.1.4)
@@ -45,13 +45,11 @@
   ())
 
-;;;; dso+
+;; TODO: Why doesn't this use with-temporary-allocations? -dso
 (defun handle-error (henv hdbc hstmt)
   (let
-      ((sql-state (alloc-chars 256)) ; TODO: How do we know this is
-				     ; big enough?
+      ((sql-state (alloc-chars 256))
        (error-message (alloc-chars #.$SQL_MAX_MESSAGE_LENGTH))
        (error-code (cffi:foreign-alloc 'sql-integer))
        (msg-length (cffi:foreign-alloc 'sql-small-int)))
-    ;; TODO: Does this include null-terminator for error-message?
     (SQLError henv
               hdbc
@@ -70,5 +68,4 @@
 ;; problem: calling SQLError clears the error state
 ;#+ignore
-;;;; dso+
 (defun sql-state (henv hdbc hstmt)
   (with-temporary-allocations
@@ -169,7 +166,5 @@
 
 
-;;;; dso+
 (defun %new-environment-handle ()
-  (declare (ftype sql-h-env))
   (cffi:with-foreign-object (phenv 'sql-h-env)
     (with-error-handling
@@ -178,5 +173,4 @@
       (cffi:mem-ref phenv 'sql-h-env))))
 
-;;;; dso+
 (defun %new-db-connection-handle (henv)
   (cffi:with-foreign-object (phdbc 'sql-h-dbc)
@@ -186,5 +180,4 @@
       (cffi:mem-ref phdbc 'sql-h-dbc))))
 
-;;;; dso+
 (defun %free-statement (hstmt option)
   (with-error-handling
@@ -221,5 +214,4 @@
 
 ;;
-;;;; dso+
 (defun %sql-driver-connect (henv hdbc connection-string completion-option)
   (declare (string connection-string))
@@ -244,11 +236,9 @@
                               (length connection-string) ;$SQL_NTS
                               complete-connection-str-ptr
-                              1024      ; TODO: Should this 1023, for
-					; the terminating char?
+                              1024
                               length-ptr
                               completion-option))
         (get-string-nts complete-connection-str-ptr)))))
 
-;;;; dso+
 (defun %disconnect (hdbc)
   (with-error-handling
@@ -256,5 +246,4 @@
       (SQLDisconnect hdbc)))
 
-;;;; dso+
 (defun %commit (henv hdbc)
   (with-error-handling
@@ -263,5 +252,4 @@
        henv hdbc $SQL_COMMIT)))
 
-;;;; dso+
 (defun %rollback (henv hdbc)
   (with-error-handling
@@ -272,5 +260,4 @@
 ; col-nr is zero-based in Lisp
 ; col-nr = :bookmark retrieves a bookmark.
-;;;; dso+
 (defun %bind-column (hstmt column-nr c-type data-ptr precision out-len-ptr)
   (declare ((integer 0) column-nr))
@@ -282,5 +269,4 @@
 
 ; parameter-nr is zero-based in Lisp
-;;;; dso+
 (defun %sql-bind-parameter (hstmt parameter-nr parameter-type c-type
                             sql-type precision scale data-ptr
@@ -300,5 +286,4 @@
                         )))
 
-;;;; dso+
 (defun %sql-fetch (hstmt)
   (with-error-handling 
@@ -306,5 +291,4 @@
       (SQLFetch hstmt)))
 
-;;;; dso+
 (defun %new-statement-handle (hdbc)
   (with-temporary-allocations
@@ -315,5 +299,4 @@
       (cffi:mem-ref hstmt-ptr 'sql-h-stmt))))
 
-;;;; dso+
 (defun %sql-get-info (hdbc info-type)
   (ecase info-type
@@ -450,7 +433,10 @@
       #.$SQL_UNION)
      (with-temporary-allocations
-         ((info-ptr (cffi:foreign-alloc :uint32)) ; TODO: It'd be nice
-						  ; to have this as a
-						  ; sql-* type.
+         ;; TODO: It'd be nice to have this as a sql-* type.  However,
+         ;; while the X/Open spec is usually quiet about data sizes,
+         ;; it specifically says a 32-bit bitmask for these; so if
+         ;; SQL-INTEGER changes to 64-bit, these may or may not change
+         ;; as well. -dso
+         ((info-ptr (cffi:foreign-alloc :uint32))
           (info-length-ptr (cffi:foreign-alloc 'sql-small-int)))
        (with-error-handling
@@ -481,5 +467,4 @@
          (cffi:mem-ref info-ptr 'sql-integer))))))
 
-;;;; dso+
 (defun %sql-exec-direct (sql hstmt henv hdbc)
   (declare (string sql))
@@ -489,5 +474,4 @@
         (SQLExecDirect hstmt sql-ptr $SQL_NTS))))
 
-;;;; dso+
 (defun %sql-execute (hstmt)
   (with-error-handling
@@ -495,5 +479,4 @@
       (SQLExecute hstmt)))
 
-;;;; dso+
 (defun result-columns-count (hstmt)
   (with-temporary-allocations 
@@ -503,5 +486,4 @@
       (cffi:mem-ref columns-nr-ptr 'sql-small-int))))
 
-;;;; dso+
 (defun result-rows-count (hstmt)
   (with-temporary-allocations 
@@ -516,5 +498,4 @@
 
 ;; Column counting is 1-based
-;;;; dso+
 (defun %describe-column (hstmt column-nr)
   (declare ((integer 1) column-nr))
@@ -528,6 +509,4 @@
     (with-error-handling (:hstmt hstmt)
         (SQLDescribeCol hstmt column-nr column-name-ptr 256
-                        ;; TODO: Does 256 leave room for terminating
-                        ;; nulls?
                         column-name-length-ptr
                         column-sql-type-ptr
@@ -572,5 +551,4 @@
 
 
-;;;; dso+
 (defun %sql-prepare (hstmt sql)
   (declare (string sql))
@@ -579,5 +557,4 @@
         (SQLPrepare hstmt sql-ptr $SQL_NTS))))
 
-;;;; dso+
 (defun set-connection-option (hdbc option param)
   (with-error-handling (:hdbc hdbc)
@@ -591,14 +568,12 @@
 
 
-***
+;;;***
 ;;; rav, 11.6.2005
 ;;; added tracing support
 
-;;;; dso+
 (defun set-connection-attr-integer (hdbc option val)
   (with-error-handling (:hdbc hdbc)
       (SQLSetConnectAttr_long hdbc option val 0)))
 
-;;;; dso+
 (defun set-connection-attr-string (hdbc option val)
   (with-error-handling  (:hdbc hdbc)
@@ -613,41 +588,8 @@
 (defun %stop-connection-trace (hdbc)
   (set-connection-attr-integer hdbc $SQL_ATTR_TRACE	$SQL_OPT_TRACE_OFF))
-  
-
-(defun get-connection-attr-integer (hdbc attr)
-  (with-temporary-allocations
-      ((ptr (cffi:foreign-alloc :long))
-       (lenptr (cffi:foreign-alloc :long)))
-    (with-error-handling (:hdbc hdbc)
-      (SQLGetConnectAttr hdbc attr ptr 0 lenptr))
-    (cffi:mem-ref ptr :long)))
-
-(defun get-connection-attr-string (hdbc attr)
-  (with-temporary-allocations 
-      ((ptr (alloc-chars 256))
-       (lenptr (cffi:foreign-alloc :long)))
-    (with-error-handling (:hdbc hdbc)
-      (SQLGetConnectAttr hdbc attr ptr 256 lenptr))
-    (get-string  ptr (cffi:mem-ref lenptr :long))))
-
-;;; small test for the get-connection-attr
-(defun %get-current-catalog (hdbc)
-  (get-connection-attr-string hdbc $SQL_ATTR_CURRENT_CATALOG))
-
-(defun %set-current-catalog (hdbc catalog)
-  (set-connection-attr-string hdbc $SQL_ATTR_CURRENT_CATALOG catalog))
-
-
-
-(defun %connection-ok-p (hdbc)
-  (with-error-handling (:hdbc hdbc)
-    (ecase (get-connection-attr-integer hdbc $SQL_ATTR_CONNECTION_DEAD)
-      (#.$sql_cd_true nil)
-      (#.$sql_cd_false t))))
 
 ;;;
 
 ; column-nr is zero-based
-;;;; dso+
 (defun %sql-get-data (hstmt column-nr c-type data-ptr precision out-len-ptr)
   (declare ((integer 0) column-nr))
@@ -657,5 +599,4 @@
                   c-type data-ptr precision out-len-ptr)))
 
-;;;; dso+
 (defun %sql-get-data-raw (hstmt position c-type data-ptr buffer-length ind-ptr)
   (declare ((integer 0) position))
@@ -664,5 +605,4 @@
 
 
-;;;; dso+
 (defun %sql-param-data (hstmt param-ptr)
   (with-error-handling (:hstmt hstmt :print-info t) ;; nil
@@ -670,5 +610,4 @@
 
 
-;;;; dso+
 (defun %sql-put-data (hstmt data-ptr size)
   (with-error-handling
@@ -677,5 +616,4 @@
 
 
-;;;; dso+
 (defun %sql-more-results (hstmt)
   (let ((res (SQLMoreResults hstmt)))
