- new record type: sql-date (SQL_DATE_STRUCT)
- new record type: sql-time (SQL_TIME_STRUCT) - new record type: sql-timestamp (SQL_TIMESTAMP_STRUCT) - added type identifier for SQL_C_*-types and SQL_*-types - import c-functions: odbc_sql_bind_parameter_exec_out, odbc_sql_execute, odbc_sql_execute_direct, odbc_sql_get_data, odbc_sql_fetch
This commit is contained in:
parent
d88ed1c5b8
commit
d2ce1ffa08
|
@ -1,37 +1,44 @@
|
|||
|
||||
;;; record types
|
||||
|
||||
;(define-record-type sql-date :sql-date
|
||||
; (make-sql-date year month day)
|
||||
; sql-date?
|
||||
; (year sql-date-year sql-date-year!)
|
||||
; (month sql-date-month sql-date-month!)
|
||||
; (day sql-date-day sql-date-day!))
|
||||
;(define-record-type sql-time :sql-time
|
||||
; (make-sql-time hour minute second)
|
||||
; sql-time?
|
||||
; (hour sql-time-hour sql-time-hour!)
|
||||
; (minute sql-time-minute sql-time-minute!)
|
||||
; (second sql-time-second sql-time-second!))
|
||||
(define-record-type sql-date :sql-date
|
||||
(make-sql-date year month day)
|
||||
sql-date?
|
||||
(year sql-date-year sql-date-year!)
|
||||
(month sql-date-month sql-date-month!)
|
||||
(day sql-date-day sql-date-day!))
|
||||
|
||||
;(define-record-type sql-timestamp :sql-timestamp
|
||||
; (make-sql-timestamp year month day hour minute second fraction)
|
||||
; sql-timestamp?
|
||||
; (year sql-timestamp-year sql-timestamp-year!)
|
||||
; (month sql-timestamp-month sql-timestamp-month!)
|
||||
; (day sql-timestamp-day sql-timestamp-day!)
|
||||
; (hour sql-timestamp-hour sql-timestamp-hour!)
|
||||
; (minute sql-timestamp-minute sql-timestamp-minute!)
|
||||
; (second sql-timestamp-second sql-timestamp-second!)
|
||||
; (fraction sql-timestamp-fraction sql-timestamp-fraction!))
|
||||
(define-exported-binding "sql-date-record-type" :sql-date)
|
||||
|
||||
;(define-record-type sql-numeric :sql-numeric
|
||||
; (make-sql-numeric precision scale sign value)
|
||||
; sql-numeric?
|
||||
; (precision sql-precision sql-precision!)
|
||||
; (scale sql-scale sql-scale!)
|
||||
; (sign sql-sign sql-sign!)
|
||||
; (value sql-value sql-value!))
|
||||
(define-record-type sql-time :sql-time
|
||||
(make-sql-time hour minute second)
|
||||
sql-time?
|
||||
(hour sql-time-hour sql-time-hour!)
|
||||
(minute sql-time-minute sql-time-minute!)
|
||||
(second sql-time-second sql-time-second!))
|
||||
|
||||
(define-exported-binding "sql-time-record-type" :sql-time)
|
||||
|
||||
(define-record-type sql-timestamp :sql-timestamp
|
||||
(make-sql-timestamp year month day hour minute second fraction)
|
||||
sql-timestamp?
|
||||
(year sql-timestamp-year sql-timestamp-year!)
|
||||
(month sql-timestamp-month sql-timestamp-month!)
|
||||
(day sql-timestamp-day sql-timestamp-day!)
|
||||
(hour sql-timestamp-hour sql-timestamp-hour!)
|
||||
(minute sql-timestamp-minute sql-timestamp-minute!)
|
||||
(second sql-timestamp-second sql-timestamp-second!)
|
||||
(fraction sql-timestamp-fraction sql-timestamp-fraction!))
|
||||
|
||||
(define-exported-binding "sql-timestamp-record-type" :sql-timestamp)
|
||||
|
||||
(define-record-type sql-numeric :sql-numeric
|
||||
(make-sql-numeric precision scale sign value)
|
||||
sql-numeric?
|
||||
(precision sql-precision sql-precision!)
|
||||
(scale sql-scale sql-scale!)
|
||||
(sign sql-sign sql-sign!)
|
||||
(value sql-value sql-value!))
|
||||
|
||||
;;; handle type identifiers from sql.h
|
||||
(define handle-type-env 1)
|
||||
|
@ -49,6 +56,38 @@
|
|||
(define sql-datasources-fetch-next 1)
|
||||
(define sql-datasources-fetch-first 2)
|
||||
|
||||
;;; C type identifier
|
||||
|
||||
(define sql-type-c-char 1)
|
||||
(define sql-type-c-long 4)
|
||||
(define sql-type-c-short 5)
|
||||
(define sql-type-c-float 7)
|
||||
(define sql-type-c-double 8)
|
||||
(define sql-type-c-numeric 2)
|
||||
(define sql-type-c-default 99)
|
||||
(define sql-type-c-date 9)
|
||||
(define sql-type-c-time 10)
|
||||
(define sql-type-c-timestamp 11)
|
||||
(define sql-type-c-binary -2)
|
||||
(define sql-type-c-bit -7)
|
||||
|
||||
;;; ODBC type identifier
|
||||
|
||||
(define sql-type-unknown 0)
|
||||
(define sql-type-char 1)
|
||||
(define sql-type-numeric 2)
|
||||
(define sql-type-decimal 3)
|
||||
(define sql-type-integer 4)
|
||||
(define sql-type-smallint 5)
|
||||
(define sql-type-float 6)
|
||||
(define sql-type-real 7)
|
||||
(define sql-type-double 8)
|
||||
(define sql-type-datetime 9)
|
||||
(define sql-type-varchar 12)
|
||||
(define sql-type-date 91)
|
||||
(define sql-type-time 92)
|
||||
(define sql-type-timestamp 93)
|
||||
|
||||
;;;; just for testing purposes, will disappear soon
|
||||
;(define open-db
|
||||
; (lambda (server user auth)
|
||||
|
@ -180,13 +219,28 @@
|
|||
(stmt-handle stmt-txt)
|
||||
"odbc_sql_prepare")
|
||||
|
||||
(import-lambda-definition odbc-sql-bind-parameter-exec-out
|
||||
(stmt-handle param-vals)
|
||||
"odbc_sql_bind_parameter_exec_out")
|
||||
|
||||
;;; PART 6
|
||||
(import-lambda-definition odbc-sql-execute
|
||||
(stmt-handle)
|
||||
"odbc_sql_execute")
|
||||
|
||||
(import-lambda-definition odbc-sql-execute-direct
|
||||
(stmt-handle stmt-txt)
|
||||
"odbc_sql_execute_direct")
|
||||
|
||||
|
||||
;;; PART 7
|
||||
(import-lambda-definition odbc-sql-get-data
|
||||
(stmt-handle column-number target-type)
|
||||
"odbc_sql_get_data")
|
||||
|
||||
(import-lambda-definition odbc-sql-fetch
|
||||
(stmt-handle)
|
||||
"odbc_sql_fetch")
|
||||
|
||||
;;; PART 8
|
||||
|
||||
|
|
Loading…
Reference in New Issue