From 570798eb781157ad988bd527232bb88d51b103d7 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Thu, 2 Sep 2004 22:09:43 +0000 Subject: [PATCH] r9959: more odbc v3 conversions --- ChangeLog | 3 +++ db-odbc/odbc-api.lisp | 5 +++-- db-odbc/odbc-constants.lisp | 7 +++++++ db-odbc/odbc-ff-interface.lisp | 17 +++++++++++++++++ db-odbc/odbc-sql.lisp | 1 + 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22528cc..e32893b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +02 Sep 2004 Kevin Rosenberg + * db-odbc/odbc-api.lisp: More conversions to ODBC v3 + 02 Sep 2004 Kevin Rosenberg * Version 3.0.2 Release * TODO: Add note about ODBC on Windows diff --git a/db-odbc/odbc-api.lisp b/db-odbc/odbc-api.lisp index 492bf82..4095f6c 100644 --- a/db-odbc/odbc-api.lisp +++ b/db-odbc/odbc-api.lisp @@ -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) diff --git a/db-odbc/odbc-constants.lisp b/db-odbc/odbc-constants.lisp index 591a3af..e6cc0bd 100644 --- a/db-odbc/odbc-constants.lisp +++ b/db-odbc/odbc-constants.lisp @@ -24,6 +24,13 @@ ;; (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 diff --git a/db-odbc/odbc-ff-interface.lisp b/db-odbc/odbc-ff-interface.lisp index ba3362e..7b78023 100644 --- a/db-odbc/odbc-ff-interface.lisp +++ b/db-odbc/odbc-ff-interface.lisp @@ -23,7 +23,15 @@ (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 ) @@ -356,6 +364,15 @@ :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) diff --git a/db-odbc/odbc-sql.lisp b/db-odbc/odbc-sql.lisp index 385d378..31d8a4e 100644 --- a/db-odbc/odbc-sql.lisp +++ b/db-odbc/odbc-sql.lisp @@ -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 -- 2.34.1