r9959: more odbc v3 conversions
authorKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 2 Sep 2004 22:09:43 +0000 (22:09 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 2 Sep 2004 22:09:43 +0000 (22:09 +0000)
ChangeLog
db-odbc/odbc-api.lisp
db-odbc/odbc-constants.lisp
db-odbc/odbc-ff-interface.lisp
db-odbc/odbc-sql.lisp

index 22528ccd2e81953232a365d502cdbf541464542e..e32893b757a20d72ec361b7182ec2b45239571a6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+02 Sep 2004 Kevin Rosenberg <kevin@rosenberg.net>
+       * db-odbc/odbc-api.lisp: More conversions to ODBC v3
+       
 02 Sep 2004 Kevin Rosenberg <kevin@rosenberg.net>
        * Version 3.0.2 Release
        * TODO: Add note about ODBC on Windows
index 492bf826f6dcfaedff31eac124d7da4b5e36a737..4095f6cfeef3d4872add1725fd31daa8cd58f587 100644 (file)
@@ -151,7 +151,7 @@ as possible second argument) to the desired representation of date/time/timestam
         (with-foreign-object (phenv 'sql-handle)
           (with-error-handling
               ()
-            (SQLAllocEnv phenv)
+            (SQLAllocHandle $SQL_HANDLE_ENV +null-handle-ptr+ phenv)
             (deref-pointer phenv 'sql-handle)))))
     (%set-attr-odbc-version henv $SQL_OV_ODBC3)
     henv))
@@ -164,9 +164,10 @@ as possible second argument) to the desired representation of date/time/timestam
 
 (defun %new-db-connection-handle (henv)
   (with-foreign-object (phdbc 'sql-handle)
+    (setf (deref-pointer phdbc sql-handle) +null-handle-ptr+)
     (with-error-handling
       (:henv henv)
-      (SQLAllocConnect henv phdbc)
+      (SQLAllocHandle $SQL_HANDLE_DBC henv phdbc)
       (deref-pointer phdbc 'sql-handle))))
 
 (defun %free-statement (hstmt option)
index 591a3afa43fcc76c0f7a3f0df4e15bbd62652eae..e6cc0bdf6f56ed34dbaaab018cafd95ef35a6828 100644 (file)
 
 ;; (defconstant $ODBCVER       #x0210)
 
+
+;; for new SQLAllocHandle functiion
+(defconstant $SQL_HANDLE_ENV 1)
+(defconstant $SQL_HANDLE_DBC 2)
+(defconstant $SQL_HANDLE_STMT 3)
+(defconstant $SQL_HANDLE_DESC 4)
+
 ;; generally useful constants
 (defconstant $SQL_SPEC_MAJOR 2)                ;; Major version of specification 
 (defconstant $SQL_SPEC_MINOR 10)       ;; Minor version of specification 
index ba3362e9b3e2c49690ad570f30605ece7bdc5a52..7b780233db545f6a9abbe95054e7cd25fa00b43a 100644 (file)
 (def-foreign-type string-ptr '(* :unsigned-char))
 (def-type long-ptr-type '(* #.$ODBC-LONG-TYPE))
 
+;; odbc v3
+(def-function "SQLAllocHandle"
+    ((handle-type :short)
+     (input-handle sql-handle)
+     (*phenv sql-handle-ptr))
+  :module "odbc"
+  :returning :short)
 
+;; deprecated
 (def-function "SQLAllocEnv"
     ((*phenv sql-handle-ptr)    ; HENV   FAR *phenv
      )
   :module "odbc"
   :returning :short)
 
+(def-function "SQLGetEnvAttr"
+    ((henv sql-handle)          ; HENV        henv
+     (attr :int)
+     (*value :pointer-void)
+     (szLength :int)
+     (string-length-ptr (* :int)))
+  :module "odbc"
+  :returning :short)
+
 (def-function "SQLTables"
     ((hstmt :pointer-void)
      (catalog-name :pointer-void)
index 385d378ee8adb9c084837503540e86f5775a2299..31d8a4ecd5692cba9324f68c395a6a978fb92715 100644 (file)
@@ -52,6 +52,7 @@
          ;; underlying database
          (initialize-database-type :database-type database-type)
          db)
+      #+ignore
       (error ()        ;; Init or Connect failed
        (error 'sql-connection-error
               :database-type database-type