+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
(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))
(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)
;; (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
(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)
;; underlying database
(initialize-database-type :database-type database-type)
db)
+ #+ignore
(error () ;; Init or Connect failed
(error 'sql-connection-error
:database-type database-type