- represent handles as Scheme records of diffrent types
(environment-handle, connection-handle, statement-handle, database-handle) - make ODBC functions these records - Tons of constants for SQLGetInfo() - get rid of some stupid pseudo-highlevel-ODBC-functions
This commit is contained in:
parent
29115fc716
commit
9b85dcf9da
|
@ -1,8 +1,45 @@
|
|||
;;; handle type identifiers from sql.h
|
||||
(define handle-type-env 1)
|
||||
(define handle-type-dbc 2)
|
||||
(define handle-type-stmt 3)
|
||||
(define handle-type-desc 4)
|
||||
;;; ODBC handle types
|
||||
(define-record-type environment-handle :environment-handle
|
||||
(really-make-environment-handle handle)
|
||||
environment-handle?
|
||||
(handle environment-handle-handle))
|
||||
|
||||
(define-exported-binding "environment-handle" :environment-handle)
|
||||
|
||||
(define-record-type connection-handle :connection-handle
|
||||
(really-make-connection-handle handle)
|
||||
connection-handle?
|
||||
(handle connection-handle-handle))
|
||||
|
||||
(define-exported-binding "connection-handle" :connection-handle)
|
||||
|
||||
(define-record-type statement-handle :statement-handle
|
||||
(really-make-statement-handle handle)
|
||||
statement-handle?
|
||||
(handle statement-handle-handle))
|
||||
|
||||
(define-exported-binding "statement-handle" :statement-handle)
|
||||
|
||||
(define-record-type database-handle :database-handle
|
||||
(really-make-database-handle handle)
|
||||
database-handle?
|
||||
(handle database-handle-handle))
|
||||
|
||||
(define-exported-binding "database-handle" :database-handle)
|
||||
|
||||
(define (odbc-handle? thing)
|
||||
(or (environment-handle? thing)
|
||||
(connection-handle? thing)
|
||||
(statement-handle? thing)
|
||||
(database-handle? thing)))
|
||||
|
||||
;;; 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
|
||||
((connection-handle? record) 2) ; SQL_HANDLE_DBC
|
||||
((statement-handle? record) 3) ; SQL_HANDLE_STMT
|
||||
(else
|
||||
(error "Unknown handle type: " record))))
|
||||
|
||||
;;; options for SQLFreeStmt from sql.h
|
||||
(define sql-disconnect-opt-close 0)
|
||||
|
@ -126,67 +163,162 @@
|
|||
(define sql-api-sqlsetscrolloptions 69)
|
||||
(define sql-api-sqltableprivileges 70)
|
||||
|
||||
;;; info keys for odbc-sql-get-info-int/string
|
||||
;;; TODO: sort on return value type!
|
||||
;;; info keys for odbc-sql-get-info-argint/string
|
||||
; ODBC 1.0, returns integer
|
||||
(define sql-get-info-arg-maxdriverconnections 0)
|
||||
; ODBC 1.0, returns integer
|
||||
(define sql-get-info-arg-maxconcurrentactivities 1)
|
||||
; ODBC 1.0, returns string
|
||||
(define sql-get-info-arg-datasourcename 2)
|
||||
; deprecated in ODBC 3.x returns ?
|
||||
(define sql-get-info-arg-fetchdirection 8)
|
||||
; ODBC 1.0, returns string
|
||||
(define sql-get-info-arg-servername 13)
|
||||
; ODBC 1.0, returns string
|
||||
(define sql-get-info-arg-searchpatternescape 14)
|
||||
; ODBC 1.0, returns string
|
||||
(define sql-get-info-arg-dbmsname 17)
|
||||
; ODBC 1.0, returns string
|
||||
(define sql-get-info-arg-dbmsver 18)
|
||||
; ODBC 1.0, returns string
|
||||
(define sql-get-info-arg-accessibletables 19)
|
||||
; ODBC 1.0, returns string
|
||||
(define sql-get-info-arg-accessibaleprocedures 20)
|
||||
; ODBC 1.0, returns integer
|
||||
(define sql-get-info-arg-cursor-commit-behaviour 23)
|
||||
; ODBC 1.0, returns string
|
||||
(define sql-get-info-arg-datasourcereadonly 25)
|
||||
; ODBC 1.0, returns integer
|
||||
(define sql-get-info-arg-defaulttxnisolation 26)
|
||||
; ODBC 1.0, returns integer
|
||||
(define sql-get-info-arg-identifiercase 28)
|
||||
; ODBC 1.0, returns string
|
||||
(define sql-get-info-arg-identifierquotechar 29)
|
||||
; ODBC 1.0 returns integer
|
||||
(define sql-get-info-arg-maxcolumnnamelen 30)
|
||||
(define sql-get-info-arg-maximumcolumnnamelen 30)
|
||||
; ODBC 1.0 returns integer
|
||||
(define sql-get-info-arg-maxcursornamelen 31)
|
||||
(define sql-get-info-arg-maximumcursornamelen 31)
|
||||
; ODBC 1.0 returns integer
|
||||
(define sql-get-info-arg-maxschemanamelen 32)
|
||||
(define sql-get-info-arg-maximumschemenamelen 32)
|
||||
; ODBC 1.0 returns integer
|
||||
(define sql-get-info-arg-maxcatalognamelen 34)
|
||||
(define sql-get-info-arg-maximumcatalognamelen 34)
|
||||
; ODBC 1.0 returns integer
|
||||
(define sql-get-info-arg-maxtablenamelen 35)
|
||||
; defined in sql.h, but no reference in ODBC manual
|
||||
; (define sql-get-info-arg--scrollconcurrency 43)
|
||||
; ODBC 1.0 returns integer
|
||||
(define sql-get-info-arg-txncapable 46)
|
||||
(define sql-get-info-arg-transaction-capable 46)
|
||||
; ODBC 1.0 returns string
|
||||
(define sql-get-info-arg-username 47)
|
||||
; ODBC 1.0 returns integer
|
||||
(define sql-get-info-arg-txnisolationoption 72)
|
||||
(define sql-get-info-arg-transcationisolationoption 72)
|
||||
; ODBC 1.0 returns string
|
||||
(define sql-get-info-arg-integrity 73)
|
||||
; ODBC 2.0 returns integer
|
||||
(define sql-get-info-arg-getdataextensions 81)
|
||||
; ODBC 2.0 returns integer
|
||||
(define sql-get-info-arg-nullcollation 85)
|
||||
; ODBC 2.0 returns integer
|
||||
(define sql-get-info-arg-altertable 86)
|
||||
; ODBC 2.0 returns string
|
||||
(define sql-get-info-arg-specialcharacters 94)
|
||||
; ODBC 2.0 returns integer
|
||||
(define sql-get-info-arg-maxcolumnsingroupby 97)
|
||||
(define sql-get-info-arg-maximumcolumnsingroupby 97)
|
||||
; ODBC 2.0 returns integer
|
||||
(define sql-get-info-arg-maxcolumnsinindex 98)
|
||||
(define sql-get-info-arg-maximumcolumnsinindex 98)
|
||||
; ODBC 2.0 returns integer
|
||||
(define sql-get-info-arg-maxcolumnsinorderby 99)
|
||||
(define sql-get-info-arg-maximumcolumnsinorderby 99)
|
||||
; ODBC 2.0 returns integer
|
||||
(define sql-get-info-arg-maxcolumnsinselect 100)
|
||||
(define sql-get-info-arg-maximumcolumnsinselect 100)
|
||||
; ODBC 2.0 returns integer
|
||||
(define sql-get-info-arg-maxcolumnsintable 101)
|
||||
; ODBC 2.0 returns integer
|
||||
(define sql-get-info-arg-maxindexsize 102)
|
||||
(define sql-get-info-arg-maximumindexsize 102)
|
||||
; ODBC 2.0 returns integer
|
||||
(define sql-get-info-arg-maxrowsize 104)
|
||||
(define sql-get-info-arg-maximumrowsize 104)
|
||||
; ODBC 2.0 returns integer
|
||||
(define sql-get-info-arg-maxstatementlen 105)
|
||||
(define sql-get-info-arg-maximumstatemenlen 105)
|
||||
; ODBC 2.0 returns integer
|
||||
(define sql-get-info-arg-maxtablesinselect 106)
|
||||
(define sql-get-info-arg-maximumtablesinselect 106)
|
||||
; ODBC 2.0 returns integer
|
||||
(define sql-get-info-arg-maxusernamelen 107)
|
||||
(define sql-get-info-arg-maximumusernamelen 107)
|
||||
; ODBC 2.01 returns integer
|
||||
(define sql-get-info-arg-ojcapabilities 115)
|
||||
(define sql-get-info-arg-outerjoincapabilities 115)
|
||||
|
||||
(define sql-get-info-maxdriverconnections 0)
|
||||
(define sql-get-info-maximumdriverconnections 0)
|
||||
(define sql-get-info-maxconcurrentactivities 1)
|
||||
(define sql-get-info-maximumconcurrentactivities 1)
|
||||
(define sql-get-info-datasourcename 2)
|
||||
(define sql-get-info-fetchdirection 8)
|
||||
(define sql-get-info-servername 13)
|
||||
(define sql-get-info-searchpatternescape 14)
|
||||
(define sql-get-info-dbmsname 17)
|
||||
(define sql-get-info-dbmsver 18)
|
||||
(define sql-get-info-accessibletable 19)
|
||||
(define sql-get-info-accessibaleprocedures 20)
|
||||
(define sql-get-info-cursor-commit-behaviour 23)
|
||||
(define sql-get-info-datasourcereadonly 25)
|
||||
(define sql-get-info-defaulttxnisolation 26)
|
||||
(define sql-get-info-identifiercase 28)
|
||||
(define sql-get-info-identifierquotechar 29)
|
||||
(define sql-get-info-maxcolumnnamelen 30)
|
||||
(define sql-get-info-maximumcolumnnamelen 30)
|
||||
(define sql-get-info-maxcursornamelen 31)
|
||||
(define sql-get-info-maximumcursornamelen 31)
|
||||
(define sql-get-info-maxschemanamelen 32)
|
||||
(define sql-get-info-maximumschemenamelen 32)
|
||||
(define sql-get-info-maxcatalognamelen 34)
|
||||
(define sql-get-info-maximumcatalognamelen 34)
|
||||
(define sql-get-info-maxtablenamelen 35)
|
||||
(define sql-get-info-scrollconcurrency 43)
|
||||
(define sql-get-info-txncapable 46)
|
||||
(define sql-get-info-transaction-capable 46)
|
||||
(define sql-get-info-username 47)
|
||||
(define sql-get-info-txpisolationoption 72)
|
||||
(define sql-get-info-transcationisolationoption 72)
|
||||
(define sql-get-info-integrity 73)
|
||||
(define sql-get-info-getdataextensions 81)
|
||||
(define sql-get-info-nullcollation 85)
|
||||
(define sql-get-info-altertable 86)
|
||||
(define sql-get-info-specialcharacters 94)
|
||||
(define sql-get-info-maxcolumnsingroupby 97)
|
||||
(define sql-get-info-maximumcolumnsingroupby 97)
|
||||
(define sql-get-info-maxcolumnsinindex 98)
|
||||
(define sql-get-info-maximumcolumnsinindex 98)
|
||||
(define sql-get-info-maxcolumnsinorderby 99)
|
||||
(define sql-get-info-maximumcolumnsinorderby 99)
|
||||
(define sql-get-info-maxcolumnsinselect 100)
|
||||
(define sql-get-info-maximumcolumnsinselect 100)
|
||||
(define sql-get-info-maxcolumnsintable 101)
|
||||
(define sql-get-info-maxindexsize 102)
|
||||
(define sql-get-info-maximumindexsize 102)
|
||||
(define sql-get-info-maxrowsize 104)
|
||||
(define sql-get-info-maximumrowsize 104)
|
||||
(define sql-get-info-maxstatementlen 105)
|
||||
(define sql-get-info-maximumstatemenlen 105)
|
||||
(define sql-get-info-maxtablesinselect 106)
|
||||
(define sql-get-info-maximumtablesinselect 106)
|
||||
(define sql-get-info-maxusernamelen 107)
|
||||
(define sql-get-info-maximumusernamelen 107)
|
||||
(define sql-get-info-ojcapabilities 115)
|
||||
(define sql-get-info-outerjoincapabilities 115)
|
||||
; ODBC return values for SQLGetInfo sql-get-info-arg-identifiercase (SQL_IDENTIFIER_CASE)
|
||||
(define sql-ic-upper 1)
|
||||
(define sql-ic-lower 2)
|
||||
(define sql-ic-sensitive 3)
|
||||
(define sql-ic-mixed 4)
|
||||
|
||||
; ODBC return values for SQLGetInfo sql-get-info-arg-defaulttxnisolation (SQL_DEFAULT_TXN_ISOLATION)
|
||||
(define sql-txn-read-uncommited #x00000001)
|
||||
(define sql-txn-read-committed #x00000002)
|
||||
(define sql-txn-repeatable-read #x00000004)
|
||||
(define sql-txn-serializable #x00000008)
|
||||
|
||||
; ODBC return values for SQLGetInfo sql-get-info-arg-txncapable (SQL_TXN_CAPABLE)
|
||||
(define sql-tc-none 0)
|
||||
(define sql-tc-dml 1)
|
||||
(define sql-tc-all 2)
|
||||
(define sql-tc-ddl-commit 3)
|
||||
(define sql-tc-ddl-ignore 4)
|
||||
|
||||
; ODBC return values for SQLGetInfo sql-get-info-arg-getdataextensions (SQL_GETDATA_EXTENSIONS)
|
||||
(define sql-gd-any-column #x00000001)
|
||||
(define sql-gd-any-order #x00000002)
|
||||
(define sql-gd-block #x00000004)
|
||||
(define sql-gd-bound #x00000008)
|
||||
|
||||
; ODBC return values for SQLGetInfo sql-get-info-arg-nullcollation (SQL_NULL_COLLATION)
|
||||
(define sql-nc-end #x0004)
|
||||
(define sql-nc-start #x0002)
|
||||
; missing sql-nc-high sql-nc-low
|
||||
|
||||
; ODBC return values for SQLGetInfo sql-get-info-arg-altertable (SQL_ALTER_TABLE)
|
||||
(define sql-at-add-colum #x00000001)
|
||||
(define sql-at-drop-column #x00000002)
|
||||
(define sql-at-add-constraint #x00000008)
|
||||
(define sql-at-add-column-single #x00000020)
|
||||
(define sql-at-add-column-default #x00000040)
|
||||
(define sql-at-add-column-collation #x00000080)
|
||||
(define sql-at-set-column-default #x00000100)
|
||||
(define sql-at-drop-column-default #x00000200)
|
||||
(define sql-at-drop-column-cascade #x00000400)
|
||||
(define sql-at-drop-column-restrict #x00000800)
|
||||
(define sql-at-drop-table-constraint #x00001000)
|
||||
(define sql-at-drop-table-constraint-cascade #x00002000)
|
||||
(define sql-at-drop-table-constraint-restrict #x00004000)
|
||||
(define sql-at-constraint-name-definition #x00008000)
|
||||
(define sql-at-constraint-initially-deferred #x00010000)
|
||||
(define sql-at-constraint-initially-immediate #x00020000)
|
||||
(define sql-at-constraint-deferrable #x00040000)
|
||||
(define sql-at-constraint-non-deferrable #x00080000)
|
||||
|
||||
; ODBC return values for SQLGetInfo sql-get-info-arg-ojcapabilities (SQL_OJ_CAPABILITIES)
|
||||
(define sql-oj-left #x00000001)
|
||||
(define sql-oj-right #x00000002)
|
||||
(define sql-oj-full #x00000004)
|
||||
(define sql-oj-nested #x00000008)
|
||||
(define sql-oj-not-ordered #x00000010)
|
||||
(define sql-oj-inner #x00000020)
|
||||
(define sql-oj-all-comparison-ops #x00000040)
|
||||
|
||||
;;; ODBC return values
|
||||
(define sql-error -1)
|
||||
|
@ -196,22 +328,6 @@
|
|||
(define sql-invalid-handle -2)
|
||||
(define sql-need-data 99)
|
||||
|
||||
(define-record-type odbc-environment :odbc-environment
|
||||
(really-make-odbc-environment handle)
|
||||
odbc-environment?
|
||||
(handle odbc-environment-handle set-odbc-environment-handle!))
|
||||
|
||||
(define-record-type odbc-connection :odbc-connection
|
||||
(really-make-odbc-connection handle)
|
||||
odbc-connection?
|
||||
(handle odbc-connection-handle set-odbc-connection-handle!))
|
||||
|
||||
(define-record-type odbc-statement :odbc-statement
|
||||
(really-make-odbc-statment sql-query handle)
|
||||
odbc-statement?
|
||||
(sql-query odbc-statement-sql-query)
|
||||
(handle odbc-statement-handle odbc-statement-handle!))
|
||||
|
||||
(define-record-type odbc-column :odbc-column
|
||||
(really-make-odbc-column name type size digits nullable)
|
||||
odbc-column?
|
||||
|
@ -221,227 +337,181 @@
|
|||
(digits odbc-column-digits)
|
||||
(nullable odbc-column-nullable))
|
||||
|
||||
(define make-odbc-environment
|
||||
(lambda ()
|
||||
(really-make-odbc-environment (odbc-alloc-environment-handle))))
|
||||
|
||||
(define make-odbc-connection
|
||||
(lambda (odbc-environment datasource-name user password)
|
||||
(let ((conn-handle (odbc-alloc-connection-handle
|
||||
(odbc-environment-handle odbc-environment))))
|
||||
(odbc-sql-connect conn-handle datasource-name user password)
|
||||
(really-make-odbc-connection conn-handle))))
|
||||
|
||||
(define odbc-disconnect
|
||||
(lambda (odbc-connection)
|
||||
(odbc-sql-disconnect (odbc-connection-handle odbc-connection))))
|
||||
|
||||
(define make-odbc-statement
|
||||
(lambda (odbc-connection sql-text)
|
||||
(let* ((conn-handle (odbc-connection-handle odbc-connection))
|
||||
(stmt-handle (odbc-alloc-statement-handle conn-handle)))
|
||||
(odbc-sql-prepare stmt-handle)
|
||||
(really-make-odbc-statment sql-text stmt-handle))))
|
||||
|
||||
(define odbc-get-datasources
|
||||
(lambda (odbc-environment)
|
||||
(let ((env-handle (odbc-environment-handle odbc-environment)))
|
||||
(odbc-sql-data-sources env-handle))))
|
||||
|
||||
(define odbc-get-drivers
|
||||
(lambda (odbc-environment)
|
||||
#t))
|
||||
|
||||
(define odbc-get-environment-info
|
||||
(lambda (odbc-environment key)
|
||||
#t))
|
||||
|
||||
(define odbc-get-type-info
|
||||
(lambda (odbc-statement type)
|
||||
#t))
|
||||
|
||||
(define odbc-connection-attribute
|
||||
(lambda (odbc-connection key)
|
||||
#t))
|
||||
|
||||
(define set-odbc-connection-attribute!
|
||||
(lambda (odbc-connection key value)
|
||||
#t))
|
||||
|
||||
(define odbc-environment-attribute
|
||||
(lambda (odbc-environment key)
|
||||
#t))
|
||||
|
||||
(define set-odbc-environment-attribute!
|
||||
(lambda (odbc-environment key value)
|
||||
#t))
|
||||
|
||||
(define odbc-statement-attribute
|
||||
(lambda (odbc-statement key)
|
||||
#t))
|
||||
|
||||
(define set-odbc-statement-attribute!
|
||||
(lambda (odbc-statement key value)
|
||||
#t))
|
||||
|
||||
(define odbc-sql-execute-direct
|
||||
(lambda (odbc-connection sql-query)
|
||||
(let* ((conn-handle (odbc-connection-handle odbc-connection))
|
||||
(stmt-handle (odbc-alloc-statement-handle conn-handle)))
|
||||
(odbc-sql-execute-direct stmt-handle sql-query))))
|
||||
|
||||
(define odbc-sql-execute
|
||||
(lambda (odbc-statement)
|
||||
(let ((stmt-handle (odbc-statement-handle odbc-statement)))
|
||||
(odbc-sql-execute odbc-statement))))
|
||||
|
||||
(define odbc-count-result-cols
|
||||
(lambda (odbc-statement)
|
||||
(let ((stmt-handle (odbc-statement-handle odbc-statement)))
|
||||
(odbc-sql-num-result-cols stmt-handle))))
|
||||
|
||||
(define odbc-describe-column
|
||||
(lambda (odbc-statement column-number)
|
||||
(let ((stmt-handle (odbc-statement-handle odbc-statement)))
|
||||
(odbc-sql-describe-col stmt-handle column-number))))
|
||||
|
||||
(define odbc-fetch-row
|
||||
(lambda (odbc-statement)
|
||||
(let* ((stmt-handle (odbc-statement-handle odbc-statement))
|
||||
(retval (odbc-sql-fetch stmt-handle)))
|
||||
(if (equal? retval sql-no-data)
|
||||
'()
|
||||
(let loop ((row '())
|
||||
(col (odbc-sql-num-result-cols odbc-statement)))
|
||||
(if (> col 1)
|
||||
(let* ((col-info
|
||||
(odbc-describe-column odbc-statement col))
|
||||
(data
|
||||
(odbc-sql-get-data stmt-handle col
|
||||
(odbc-column-type col-info))))
|
||||
(loop (cons data row) (- col 1)))
|
||||
row))))))
|
||||
|
||||
;;;; just for testing purposes, will disappear soon
|
||||
;(define open-db
|
||||
; (lambda (server user auth)
|
||||
; (let* ((env-handle (odbc-alloc-environment-handle))
|
||||
; (conn-handle (odbc-alloc-connection-handle env-handle)))
|
||||
; (odbc-sql-connect conn-handle server user auth))))
|
||||
|
||||
;(define list-datasources
|
||||
; (lambda ()
|
||||
; (let ((env-handle (odbc-alloc-environment-handle)))
|
||||
; (odbc-sql-data-sources env-handle sql-datasources-fetch-first))))
|
||||
|
||||
;(define list-drivers
|
||||
; (lambda ()
|
||||
; (let ((env-handle (odbc-alloc-environment-handle)))
|
||||
; (odbc-sql-drivers env-handle))))
|
||||
|
||||
;(define free-handle
|
||||
; (lambda (handle handle-type)
|
||||
; (odbc-sql-free-handle handle-type handle)))
|
||||
|
||||
;(define free-environment-handle
|
||||
; (lambda (handle)
|
||||
; (free-handle handle handle-type-env)))
|
||||
|
||||
;(define free-connection-handle
|
||||
; (lambda (handle)
|
||||
; (free-handle handle handle-type-dbc)))
|
||||
|
||||
;(define free-statement-handle
|
||||
; (lambda (handle)
|
||||
; (free-handle handle handle-type-stmt)))
|
||||
|
||||
;(define free-description-handle
|
||||
; (lambda (handle)
|
||||
; (free-handle handle handle-type-desc)))
|
||||
|
||||
;;; PART 1
|
||||
|
||||
(import-lambda-definition odbc-alloc-environment-handle
|
||||
(define (odbc-alloc-environment-handle)
|
||||
(really-make-environment-handle (odbc-alloc-environment-handle-internal)))
|
||||
|
||||
(import-lambda-definition odbc-alloc-environment-handle-internal
|
||||
()
|
||||
"odbc_alloc_environment_handle")
|
||||
|
||||
(import-lambda-definition odbc-alloc-connection-handle
|
||||
(define (odbc-alloc-connection-handle env-handle)
|
||||
(check-arg environment-handle? env-handle odbc-alloc-connection-handle)
|
||||
(really-make-connection-handle
|
||||
(odbc-alloc-connection-handle-internal (environment-handle-handle env-handle))))
|
||||
|
||||
(import-lambda-definition odbc-alloc-connection-handle-internal
|
||||
(env-handle)
|
||||
"odbc_alloc_connection_handle")
|
||||
|
||||
(import-lambda-definition odbc-alloc-statement-handle
|
||||
(define (odbc-alloc-statement-handle database-handle)
|
||||
(check-arg database-handle? database-handle odbc-alloc-statement-handle)
|
||||
(really-make-database-handle
|
||||
(odbc-alloc-statement-handle-internal (database-handle-handle database-handle))))
|
||||
|
||||
(import-lambda-definition odbc-alloc-statement-handle-internal
|
||||
(db-handle)
|
||||
"odbc_alloc_statement_handle")
|
||||
|
||||
(import-lambda-definition odbc-sql-connect
|
||||
(define (odbc-sql-connect conn-handle server-name user-name auth)
|
||||
(check-arg connection-handle? conn-handle odbc-sql-connect)
|
||||
(odbc-sql-connect-internal (connection-handle-handle conn-handle)
|
||||
server-name user-name auth))
|
||||
|
||||
(import-lambda-definition odbc-sql-connect-internal
|
||||
(conn-handle server-name user-name auth)
|
||||
"odbc_sql_connect")
|
||||
|
||||
;;; PART 2
|
||||
|
||||
(import-lambda-definition odbc-sql-data-sources
|
||||
(env-handle direction)
|
||||
(define (odbc-sql-data-sources env-handle)
|
||||
(check-arg environment-handle? env-handle odbc-sql-data-sources)
|
||||
(odbc-sql-data-sources-internal (environment-handle-handle env-handle)))
|
||||
|
||||
(import-lambda-definition odbc-sql-data-sources-internal
|
||||
(env-handle)
|
||||
"odbc_sql_data_sources")
|
||||
|
||||
(import-lambda-definition odbc-sql-drivers
|
||||
(define (odbc-sql-drivers env-handle)
|
||||
(check-arg environment-handle? env-handle odbc-sql-drivers)
|
||||
(odbc-sql-drivers-internal (environment-handle-handle env-handle)))
|
||||
|
||||
(import-lambda-definition odbc-sql-drivers-internal
|
||||
(env-handle)
|
||||
"odbc_sql_drivers")
|
||||
|
||||
(import-lambda-definition odbc-sql-get-info-int
|
||||
(define (odbc-sql-get-info-int conn-handle info-key)
|
||||
(check-arg connection-handle? conn-handle odbc-sql-get-info-int)
|
||||
(odbc-sql-get-info-int-internal (connection-handle-handle conn-handle) info-key))
|
||||
|
||||
(import-lambda-definition odbc-sql-get-info-int-internal
|
||||
(conn-handle info-key)
|
||||
"odbc_sql_get_info_int")
|
||||
|
||||
(import-lambda-definition odbc-sql-get-info-string
|
||||
(define (odbc-sql-get-info-string conn-handle info-key)
|
||||
(check-arg connection-handle-handle conn-handle odbc-sql-get-info-string)
|
||||
(odbc-sql-get-info-string-internal (connection-handle-handle conn-handle) info-key))
|
||||
|
||||
(import-lambda-definition odbc-sql-get-info-string-internal
|
||||
(conn-handle info-key)
|
||||
"odbc_sql_get_info_string")
|
||||
|
||||
(import-lambda-definition odbc-sql-get-func-exists
|
||||
(define (odbc-sql-get-func conn-handle fun-id)
|
||||
(check-arg connection-handle? conn-handle odbc-sql-get-func)
|
||||
(odbc-sql-get-func-exists-internal (connection-handle-handle conn-handle) fun-id))
|
||||
|
||||
(import-lambda-definition odbc-sql-get-func-exists-internal
|
||||
(conn-handle fun-id)
|
||||
"odbc_sql_get_func_exists")
|
||||
|
||||
(import-lambda-definition odbc-sql-get-type-info
|
||||
(define (odbc-sql-get-type-info stmt-handle data-type)
|
||||
(check-arg statement-handle? stmt-handle data-type)
|
||||
(odbc-sql-get-type-info-internal (statement-handle-handle stmt-handle) data-type))
|
||||
|
||||
(import-lambda-definition odbc-sql-get-type-info-internal
|
||||
(stmt-handle data-type)
|
||||
"odbc_sql_get_type_info")
|
||||
|
||||
;;; PART 3
|
||||
|
||||
(import-lambda-definition odbc-sql-set-connect-attr-int
|
||||
(define (odbc-sql-set-connect-attr-int conn-handle attribute value)
|
||||
(check-arg connection-handle? conn-handle odbc-sql-set-connect-attr-int)
|
||||
(odbc-sql-set-connect-attr-int-internal (connection-handle-handle conn-handle)
|
||||
attribute value))
|
||||
|
||||
(import-lambda-definition odbc-sql-set-connect-attr-int-internal
|
||||
(conn-handle attribute value)
|
||||
"odbc_sql_set_connect_attr_int")
|
||||
|
||||
(import-lambda-definition odbc-sql-set-connect-attr-string
|
||||
(define (odbc-sql-set-connect-attr-string conn-handle attribute value)
|
||||
(check-arg connection-handle? conn-handle odbc-sql-set-connect-attr-string)
|
||||
(odbc-sql-set-connect-attr-string-internal (connection-handle-handle conn-handle)
|
||||
attribute value))
|
||||
|
||||
(import-lambda-definition odbc-sql-set-connect-attr-string-internal
|
||||
(conn-handle attribute value)
|
||||
"odbc_sql_set_connect_attr_string")
|
||||
|
||||
(import-lambda-definition odbc-sql-get-connect-attr-string
|
||||
(define (odbc-sql-get-connect-attr-string conn-handle attribute)
|
||||
(check-arg connection-handle? conn-handle odbc-sql-get-connect-attr-string)
|
||||
(odbc-sql-get-connect-attr-string-internal (connection-handle-handle conn-handle)
|
||||
attribute))
|
||||
|
||||
(import-lambda-definition odbc-sql-get-connect-attr-string-internal
|
||||
(conn-handle attribute)
|
||||
"odbc_sql_get_connect_attr_string")
|
||||
|
||||
(import-lambda-definition odbc-sql-get-connect-attr-int
|
||||
(define (odbc-sql-get-connect-attr-int conn-handle attribute)
|
||||
(check-arg connection-handle? conn-handle odbc-sql-get-connect-attr-int)
|
||||
(odbc-sql-get-connect-attr-int-internal (connection-handle-handle conn-handle)
|
||||
attribute))
|
||||
|
||||
(import-lambda-definition odbc-sql-get-connect-attr-int-internal
|
||||
(conn-handle attribute)
|
||||
"odbc_sql_get_connect_attr_int")
|
||||
|
||||
(import-lambda-definition odbc-sql-set-env-attr-int
|
||||
(define (odbc-sql-set-env-attr-int env-handle attribute value)
|
||||
(check-arg environment-handle? env-handle odbc-sql-set-env-attr-int)
|
||||
(odbc-sql-set-env-attr-int-internal (environment-handle-handle env-handle)
|
||||
attribute value))
|
||||
|
||||
(import-lambda-definition odbc-sql-set-env-attr-int-internal
|
||||
(env-handle attribute value)
|
||||
"odbc_sql_set_env_attr_int")
|
||||
|
||||
(import-lambda-definition odbc-sql-get-env-attr-int
|
||||
(define (odbc-sql-get-env-attr-int env-handle attribute value)
|
||||
(check-arg environment-handle? env-handle odbc-sql-get-connect-attr-int)
|
||||
(odbc-sql-get-env-attr-int-internal (environment-handle-handle env-handle)
|
||||
attribute value))
|
||||
|
||||
(import-lambda-definition odbc-sql-get-env-attr-int-internal
|
||||
(env-handle attribute value)
|
||||
"odbc_sql_get_env_attr_int")
|
||||
|
||||
(import-lambda-definition odbc-sql-set-stmt-attr-int
|
||||
(define (odbc-sql-set-stmt-attr-int stmt-handle attribute value)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-set-stmt-attr-int)
|
||||
(odbc-sql-set-stmt-attr-int-internal (statement-handle-handle stmt-handle)
|
||||
attribute value))
|
||||
|
||||
(import-lambda-definition odbc-sql-set-stmt-attr-int-internal
|
||||
(stmt-handle attribute value)
|
||||
"odbc_sql_set_stmt_attr_int")
|
||||
|
||||
(import-lambda-definition odbc-sql-set-stmt-attr-string
|
||||
(define (odbc-sql-set-stmt-attr-string stmt-handle attribute value)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-set-stmt-attr-string)
|
||||
(odbc-sql-set-stmt-attr-string-internal (statement-handle-handle stmt-handle)
|
||||
attribute value))
|
||||
|
||||
(import-lambda-definition odbc-sql-set-stmt-attr-string-internal
|
||||
(stmt-handle attribute value)
|
||||
"odbc_sql_set_stmt_attr_string")
|
||||
|
||||
(import-lambda-definition odbc-sql-get-stmt-attr-int
|
||||
(define (odbc-sql-get-stmt-attr-int stmt-handle attribute)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-get-stmt-attr-int)
|
||||
(odbc-sql-get-stmt-attr-int-internal (statement-handle-handle stmt-handle)
|
||||
attribute))
|
||||
|
||||
(import-lambda-definition odbc-sql-get-stmt-attr-int-internal
|
||||
(stmt-handle attribute)
|
||||
"odbc_sql_get_stmt_attr_int")
|
||||
|
||||
(import-lambda-definition odbc-sql-get-stmt-attr-string
|
||||
(define (odbc-sql-get-stmt-attr-string stmt-handle attribute)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-get-stmt-attr-string)
|
||||
(odbc-sql-get-stmt-attr-string-internal (statement-handle-handle stmt-handle)
|
||||
attribute))
|
||||
|
||||
(import-lambda-definition odbc-sql-get-stmt-attr-string-internal
|
||||
(stmt-handle attribute)
|
||||
"odbc_sql_get_stmt_attr_string")
|
||||
|
||||
|
@ -449,30 +519,60 @@
|
|||
|
||||
;;; PART 5
|
||||
|
||||
(import-lambda-definition odbc-sql-prepare
|
||||
(define (odbc-sql-prepare stmt-handle stmt-txt)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-prepare)
|
||||
(odbc-sql-prepare-internal (statement-handle-handle stmt-handle)
|
||||
stmt-txt))
|
||||
|
||||
(import-lambda-definition odbc-sql-prepare-internal
|
||||
(stmt-handle stmt-txt)
|
||||
"odbc_sql_prepare")
|
||||
|
||||
(import-lambda-definition odbc-sql-bind-parameter-exec-out
|
||||
(define (odbc-sql-bind-parameter-exec-out stmt-handle param-vals)
|
||||
(check-arg statement-handle-handle stmt-handle odbc-sql-bind-parameter-exec-out)
|
||||
(odbc-sql-bind-parameter-exec-out-internal (statement-handle-handle stmt-handle)
|
||||
param-vals))
|
||||
|
||||
(import-lambda-definition odbc-sql-bind-parameter-exec-out-internal
|
||||
(stmt-handle param-vals)
|
||||
"odbc_sql_bind_parameter_exec_out")
|
||||
|
||||
;;; PART 6
|
||||
(import-lambda-definition odbc-sql-execute
|
||||
|
||||
(define (odbc-sql-execute stmt-handle)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-execute)
|
||||
(odbc-sql-execute-internal (statement-handle-handle stmt-handle)))
|
||||
|
||||
(import-lambda-definition odbc-sql-execute-internal
|
||||
(stmt-handle)
|
||||
"odbc_sql_execute")
|
||||
|
||||
(import-lambda-definition odbc-sql-execute-direct
|
||||
(define (odbc-sql-execute-direct stmt-handle stmt-txt)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-execute-direct)
|
||||
(odbc-sql-execute-direct-internal (statement-handle-handle stmt-handle)
|
||||
stmt-txt))
|
||||
|
||||
(import-lambda-definition odbc-sql-execute-direct-internal
|
||||
(stmt-handle stmt-txt)
|
||||
"odbc_sql_execute_direct")
|
||||
|
||||
|
||||
;;; PART 7
|
||||
(import-lambda-definition odbc-sql-get-data
|
||||
|
||||
(define (odbc-sql-get-data stmt-handle column-number target-type)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-get-data)
|
||||
(odbc-sql-get-data-internal (statement-handle-handle stmt-handle)
|
||||
column-number target-type))
|
||||
|
||||
(import-lambda-definition odbc-sql-get-data-internal
|
||||
(stmt-handle column-number target-type)
|
||||
"odbc_sql_get_data")
|
||||
|
||||
(import-lambda-definition odbc-sql-fetch
|
||||
(define (odbc-sql-fetch stmt-handle)
|
||||
(check-arg statement-handle-handle stmt-handle odbc-sql-fetch)
|
||||
(odbc-sql-fetch-internal (statement-handle-handle stmt-handle)))
|
||||
|
||||
(import-lambda-definition odbc-sql-fetch-internal
|
||||
(stmt-handle)
|
||||
"odbc_sql_fetch")
|
||||
|
||||
|
@ -480,33 +580,61 @@
|
|||
|
||||
;;; PART 9
|
||||
|
||||
(import-lambda-definition odbc-sql-free-statement
|
||||
(define (odbc-sql-free-statement stmt-handle option)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-free-statement)
|
||||
(odbc-sql-free-statement-internal (statement-handle-handle stmt-handle) option))
|
||||
|
||||
(import-lambda-definition odbc-sql-free-statement-internal
|
||||
(stmt-handle option)
|
||||
"odbc_sql_free_statement")
|
||||
|
||||
(import-lambda-definition odbc-sql-close-cursor
|
||||
(define (odbc-sql-close-cursor stmt-handle)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-close-cursor)
|
||||
(odbc-sql-close-cursor-internal (statement-handle-handle stmt-handle)))
|
||||
|
||||
(import-lambda-definition odbc-sql-close-cursor-internal
|
||||
(stmt-handle)
|
||||
"odbc_sql_close_cursor")
|
||||
|
||||
(import-lambda-definition odbc-sql-cancel
|
||||
(define (odbc-sql-cancel stmt-handle)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-cancel)
|
||||
(odbc-sql-cancel-internal (statement-handle-handle stmt-handle)))
|
||||
|
||||
(import-lambda-definition odbc-sql-cancel-internal
|
||||
(stmt-handle)
|
||||
"odbc_sql_cancel")
|
||||
|
||||
(import-lambda-definition odbc-sql-num-result-cols
|
||||
(define (odbc-sql-num-result-cols stmt-handle)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-num-result-cols)
|
||||
(odbc-sql-num-result-cols (statement-handle-handle stmt-handle)))
|
||||
|
||||
(import-lambda-definition odbc-sql-num-result-cols-internal
|
||||
(stmt-handle)
|
||||
"odbc_sql_num_result_cols")
|
||||
|
||||
(import-lambda-definition odbc-sql-describe-col
|
||||
(define (odbc-sql-describe-col stmt-handle column-number)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-describe-col)
|
||||
(odbc-sql-describe-col-internal (statement-handle-handle stmt-handle) column-number))
|
||||
|
||||
(import-lambda-definition odbc-sql-describe-col-internal
|
||||
(stmt-handle column-number)
|
||||
"odbc_sql_describe_col")
|
||||
|
||||
;;; PART 10
|
||||
|
||||
(import-lambda-definition odbc-sql-disconnect
|
||||
(define (odbc-sql-disconnect conn-handle)
|
||||
(check-arg connection-handle? conn-handle odbc-sql-disconnect)
|
||||
(odbc-sql-disconnect-internal (connection-handle-handle conn-handle)))
|
||||
|
||||
(import-lambda-definition odbc-sql-disconnect-internal
|
||||
(conn-handle)
|
||||
"odbc_sql_disconnect")
|
||||
|
||||
(import-lambda-definition odbc-sql-free-handle
|
||||
(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))
|
||||
|
||||
(import-lambda-definition odbc-sql-free-handle-internal
|
||||
(handle-type handle)
|
||||
"odbc_sql_free_handle")
|
||||
|
||||
|
|
Loading…
Reference in New Issue