Support for SQLGetDiagRec (odbc-sql-get-diag-recs)

This commit is contained in:
eknauel 2002-09-02 15:05:43 +00:00
parent 180850580c
commit 7efd91d54f
1 changed files with 29 additions and 1 deletions

View File

@ -27,12 +27,31 @@
(define-exported-binding "database-handle" :database-handle)
; record type to store infos from SQLGetDiagRec()
(define-record-type odbc-diag :odbc-diag
(really-make-odbc-diag-rec sql-state native-error message)
odbc-diag?
(sql-state odbc-diag-sql-state)
(native-error odbc-diag-native-error)
(message odbc-diag-message))
(define-exported-binding "odbc-diag" :odbc-diag)
(define (odbc-handle? thing)
(or (environment-handle? thing)
(connection-handle? thing)
(statement-handle? thing)
(database-handle? thing)))
(define (odbc-handle handle)
(cond
((environment-handle? handle) (environment-handle-handle handle))
((connection-handle? handle) (connection-handle-handle handle))
((statement-handle? handle) (statement-handle-handle handle))
((database-handle? handle) (database-handle-handle handle))
(else
(error "Expected odbc-handle, got " handle odbc-handle))))
;;; map a record to a handle type identifier (see sql.h)
(define (handle-record-type->c-handle-identifier record)
(cond ((environment-handle? record) 1) ; SQL_HANDLE_ENV
@ -633,8 +652,17 @@
(define (odbc-sql-free-handle handle)
(check-arg odbc-handle? handle odbc-sql-free-handle)
(odbc-sql-free-handle-internal (handle-record-type->c-handle-identifier handle)
handle))
(odbc-handle handle)))
(import-lambda-definition odbc-sql-free-handle-internal
(handle-type handle)
"odbc_sql_free_handle")
(define (odbc-sql-get-diag-recs handle)
(check-arg odbc-handle? handle odbc-sql-get-diag-recs)
(odbc-sql-get-diag-recs-internal (handle-record-type->c-handle-identifier handle)
(odbc-handle handle)))
(import-lambda-definition odbc-sql-get-diag-recs-internal
(handle-type handle)
"odbc_sql_get_diag_recs")