- rewrote exception handling system, pass ODBC status codes to Scheme
directly. This leads to multiple return values in some cases. - new condition types - raise conditions only in case of fatal errors - rewrote odbc_sql_data_sources() and odbc_sql_drivers() - removed hardcoded ODBC_RETVAL_BUFFER_INITIAL_SIZE, the return value buffer size can now be read/set from Scheme. - removed odbc_sql_bind_parameter_exec_out(), which is a poor implementation of a SQLBindParameter() binding. TODO: make a better one. - use the p.c. SQL_SUCCEEDED() - rewrote odbc_sql_get_data(): Resize return buffer value if necessary - new modules: low-odbc (functions), low-odbc-constants (constants) - major code cleanup
This commit is contained in:
parent
750de51339
commit
ad8131edad
206
scsh/odbc/README
206
scsh/odbc/README
|
@ -22,17 +22,18 @@ RCS file: /cvsroot/scsh/scsh-0.6/autogen.sh,v
|
|||
retrieving revision 1.7
|
||||
diff -u -r1.7 autogen.sh
|
||||
--- autogen.sh 12 Feb 2002 16:26:05 -0000 1.7
|
||||
+++ autogen.sh 20 Mar 2003 16:01:57 -0000
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ autogen.sh 23 Apr 2003 15:23:43 -0000
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
autoheader &&
|
||||
autoconf &&
|
||||
-./configure &&
|
||||
+./configure --with-iODBC=/usr/lib &&
|
||||
+./configure --with-iODBC=/afs/wsi/i386_fbsd46 &&
|
||||
+##./configure --with-iODBC=/usr/lib &&
|
||||
touch scsh/*.c &&
|
||||
touch build/filenames.scm &&
|
||||
rm -f scheme48.image cig/cig.image scsh/scsh.image &&
|
||||
@@ -12,5 +12,4 @@
|
||||
@@ -12,5 +13,4 @@
|
||||
make i-know-what-i-am-doing &&
|
||||
make c/scheme48.h&&
|
||||
make linker &&
|
||||
|
@ -42,11 +43,11 @@ diff -u -r1.7 autogen.sh
|
|||
Index: configure.in
|
||||
===================================================================
|
||||
RCS file: /cvsroot/scsh/scsh-0.6/configure.in,v
|
||||
retrieving revision 1.27
|
||||
diff -u -r1.27 configure.in
|
||||
--- configure.in 13 Dec 2002 15:22:13 -0000 1.27
|
||||
+++ configure.in 20 Mar 2003 16:01:57 -0000
|
||||
@@ -394,7 +394,30 @@
|
||||
retrieving revision 1.28
|
||||
diff -u -r1.28 configure.in
|
||||
--- configure.in 16 Apr 2003 12:41:36 -0000 1.28
|
||||
+++ configure.in 23 Apr 2003 15:23:43 -0000
|
||||
@@ -373,7 +373,30 @@
|
||||
AC_SUBST(LIBS)
|
||||
AC_SUBST(TMPDIR)
|
||||
|
||||
|
@ -65,12 +66,12 @@ diff -u -r1.27 configure.in
|
|||
+
|
||||
+AC_ARG_WITH(iODBC,
|
||||
+ [ --with-iODBC=DIR Support for iODBC ],
|
||||
+ [ with_iodbc=$with_iodbc ],
|
||||
+ [ with_iodbc=$withval ],
|
||||
+ [ with_iodbc=no ]
|
||||
+ )
|
||||
+if test "$with_iodbc" != no; then
|
||||
+ odbc_includes="-I$with_iodbc/include"
|
||||
+ odbc_libs="-liodbc -L$with_iodbc/lib"
|
||||
+ odbc_includes="-I$withval/include"
|
||||
+ odbc_libs="-liodbc -L$withval/lib"
|
||||
+ AC_SUBST(odbc_includes)
|
||||
+ AC_SUBST(odbc_libs)
|
||||
+fi
|
||||
|
@ -81,10 +82,10 @@ diff -u -r1.27 configure.in
|
|||
Index: Makefile.in
|
||||
===================================================================
|
||||
RCS file: /cvsroot/scsh/scsh-0.6/Makefile.in,v
|
||||
retrieving revision 1.59
|
||||
diff -u -r1.59 Makefile.in
|
||||
--- Makefile.in 13 Jan 2003 06:17:49 -0000 1.59
|
||||
+++ Makefile.in 20 Mar 2003 16:01:57 -0000
|
||||
retrieving revision 1.61
|
||||
diff -u -r1.61 Makefile.in
|
||||
--- Makefile.in 10 Mar 2003 12:13:02 -0000 1.61
|
||||
+++ Makefile.in 23 Apr 2003 15:23:43 -0000
|
||||
@@ -8,8 +8,8 @@
|
||||
VPATH = @srcdir@
|
||||
CC = @CC@
|
||||
|
@ -101,8 +102,8 @@ diff -u -r1.59 Makefile.in
|
|||
# out of the CVS repository.
|
||||
# We cannot use Scsh here since -i is not understood.
|
||||
-BUILD_RUNNABLE = /afs/wsi/i386_fbsd32/bin/scheme48
|
||||
+BUILD_RUNNABLE = /afs/wsi/ppc_macx55/scheme48-0.53/bin/scheme48
|
||||
+#BUILD_RUNNABLE = /afs/wsi/ppc_macx55/scheme48-0.53/bin/scheme48
|
||||
+BUILD_RUNNABLE = /afs/wsi/i386_fbsd32/scheme48-0.53/bin/scheme48
|
||||
RUNNABLE = scsh
|
||||
MANPAGE = $(RUNNABLE).$(manext)
|
||||
LIB = $(libdir)/$(RUNNABLE)
|
||||
|
@ -141,175 +142,34 @@ diff -u -r1.59 Makefile.in
|
|||
# Socket rules
|
||||
|
||||
c/unix/socket.o: c/scheme48.h c/fd-io.h c/event.h
|
||||
@@ -835,7 +843,8 @@
|
||||
@@ -837,7 +845,10 @@
|
||||
scsh/rx/re-high.scm \
|
||||
scsh/rx/regexp.scm \
|
||||
scsh/rx/re-low.scm \
|
||||
- scsh/rx/regress.scm
|
||||
+ scsh/rx/regress.scm \
|
||||
+ scsh/odbc/odbc-interfaces.scm \
|
||||
+ scsh/odbc/odbc-packages.scm \
|
||||
+ scsh/odbc/odbc.scm
|
||||
# scsh/dbm.scm db.scm ndbm.scm
|
||||
# jcontrol
|
||||
|
||||
@@ -861,7 +872,9 @@
|
||||
$(srcdir)/scsh/rx/packages.scm \
|
||||
$(srcdir)/scsh/scsh-package.scm \
|
||||
$(srcdir)/scsh/lib/ccp-pack.scm \
|
||||
- $(srcdir)/scsh/lib/char-package.scm
|
||||
+ $(srcdir)/scsh/lib/char-package.scm \
|
||||
+ $(srcdir)/scsh/odbc/odbc-interfaces.scm \
|
||||
+ $(srcdir)/scsh/odbc/odbc-packages.scm
|
||||
|
||||
opens = floatnums scsh ccp-lib scsh-top-package scsh-here-string-hax \
|
||||
srfi-1 srfi-13 srfi-14 # srfi-14 is also exported by scsh
|
||||
|
||||
|
||||
This will add some rules to Makefile and add two options to configure:
|
||||
--with-iODBC=PATH and --with-unixODBC=PATH.
|
||||
|
||||
This patch will add a module odbc to the package configuration. With
|
||||
this patch, it's possible to type ,open odbc at the scsh prompt to
|
||||
load all the beautiful ODBC functions into scsh:
|
||||
|
||||
Index: scsh-package.scm
|
||||
===================================================================
|
||||
RCS file: /cvsroot/scsh/scsh-0.6/scsh/scsh-package.scm,v
|
||||
retrieving revision 1.59
|
||||
diff -u -r1.59 scsh-package.scm
|
||||
--- scsh-package.scm 25 Feb 2003 12:58:37 -0000 1.59
|
||||
+++ scsh-package.scm 20 Mar 2003 16:03:38 -0000
|
||||
@@ -597,3 +597,21 @@
|
||||
signals
|
||||
srfi-9)
|
||||
(files srfi-19))
|
||||
+
|
||||
+;;; ODBC stuff
|
||||
+
|
||||
+(define-structure odbc-data-types odbc-data-types-interface
|
||||
+ (open
|
||||
+ scheme define-structure
|
||||
+ external-calls)
|
||||
+ (files (odbc odbc-types)))
|
||||
+
|
||||
+(define-structure odbc odbc-interface
|
||||
+ (open
|
||||
+ scheme define-record-types
|
||||
+ external-calls
|
||||
+ scsh-utilities
|
||||
+ conditions signals)
|
||||
+ (files (odbc odbc)
|
||||
+ (odbc odbc-bindcol)))
|
||||
+
|
||||
Index: scsh-interfaces.scm
|
||||
===================================================================
|
||||
RCS file: /cvsroot/scsh/scsh-0.6/scsh/scsh-interfaces.scm,v
|
||||
retrieving revision 1.53
|
||||
diff -u -r1.53 scsh-interfaces.scm
|
||||
--- scsh-interfaces.scm 25 Feb 2003 12:58:37 -0000 1.53
|
||||
+++ scsh-interfaces.scm 20 Mar 2003 16:03:39 -0000
|
||||
@@ -1166,13 +1166,13 @@
|
||||
(export crypt))
|
||||
|
||||
(define-interface uname-interface
|
||||
- (export uname
|
||||
- uname:os-name
|
||||
- uname:node-name
|
||||
- uname:release
|
||||
- uname:version
|
||||
- uname:machine
|
||||
- type/uname))
|
||||
+ (export uname
|
||||
+ uname:os-name
|
||||
+ uname:node-name
|
||||
+ uname:release
|
||||
+ uname:version
|
||||
+ uname:machine
|
||||
+ type/uname))
|
||||
|
||||
(define-interface md5-interface
|
||||
(export make-md5-context
|
||||
@@ -1275,3 +1275,92 @@
|
||||
;; Date to string/string to date converters.
|
||||
date->string
|
||||
string->date))
|
||||
+
|
||||
+;;; ODBC stuff
|
||||
+(define-interface odbc-data-types-interface
|
||||
+ (export
|
||||
+
|
||||
+ make-sql-date
|
||||
+ sql-date?
|
||||
+ sql-date-year
|
||||
+ sql-date-month
|
||||
+ sql-date-day
|
||||
+
|
||||
+ make-sql-time
|
||||
+ sql-time?
|
||||
+ sql-time-hour
|
||||
+ sql-time-minute
|
||||
+ sql-time-second
|
||||
+
|
||||
+ make-sql-timestamp
|
||||
+ sql-timestamp?
|
||||
+ sql-timestamp-year
|
||||
+ sql-timestamp-month
|
||||
+ sql-timestamp-day
|
||||
+ sql-timestamp-hour
|
||||
+ sql-timestamp-minute
|
||||
+ sql-timestamp-second
|
||||
+ sql-timestamp-fraction
|
||||
+
|
||||
+ make-sql-numeric
|
||||
+ sql-numeric?
|
||||
+ sql-numeric-precision
|
||||
+ sql-numeric-scale
|
||||
+ sql-numeric-sign
|
||||
+ sql-numeric-value))
|
||||
+
|
||||
+(define-interface odbc-interface
|
||||
+ (export
|
||||
+ odbc-handle?
|
||||
+ environment-handle?
|
||||
+ connection-handle?
|
||||
+ statement-handle?
|
||||
+ descriptor-handle?
|
||||
+
|
||||
+ odbc-alloc-environment-handle
|
||||
+ odbc-alloc-connection-handle
|
||||
+ odbc-alloc-statement-handle
|
||||
+ odbc-sql-connect
|
||||
+
|
||||
+ odbc-sql-data-sources
|
||||
+ odbc-sql-drivers
|
||||
+ odbc-sql-get-info-int
|
||||
+ odbc-sql-get-info-string
|
||||
+ odbc-sql-get-func
|
||||
+ odbc-sql-get-type-info
|
||||
+
|
||||
+ odbc-sql-set-connect-attr-int
|
||||
+ odbc-sql-set-connect-attr-string
|
||||
+ odbc-sql-get-connect-attr-string
|
||||
+ odbc-sql-get-connect-attr-int
|
||||
+ odbc-sql-set-env-attr-int
|
||||
+ odbc-sql-get-env-attr-int
|
||||
+ odbc-sql-set-stmt-attr-int
|
||||
+ odbc-sql-get-stmt-attr-int
|
||||
+
|
||||
+ odbc-sql-prepare
|
||||
+ odbc-sql-bind-parameter-exec-out
|
||||
+ odbc-sql-get-cursor-name
|
||||
+ odbc-sql-set-cursor-name
|
||||
+
|
||||
+ odbc-sql-execute
|
||||
+ odbc-sql-execute-direct
|
||||
+
|
||||
+ odbc-sql-row-count
|
||||
+ odbc-sql-get-data
|
||||
+ odbc-sql-fetch
|
||||
+
|
||||
+ odbc-sql-free-statement
|
||||
+ odbc-sql-close-cursor
|
||||
+ odbc-sql-cancel
|
||||
+ odbc-sql-num-result-cols
|
||||
+ odbc-sql-describe-col
|
||||
+
|
||||
+ odbc-sql-disconnect
|
||||
+ odbc-sql-free-handle
|
||||
+
|
||||
+ odbc-buffer-exceeded?
|
||||
+ signal-buffer-exceeded
|
||||
+ odbc-unbound-column?
|
||||
+ signal-unbound-column
|
||||
+ odbc-sql-bindcol))
|
||||
|
||||
Now it's time to build scsh. Edit the call to configure in autgen.sh to
|
||||
your needs, e.g.:
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
; ,open srfi-13
|
||||
|
||||
(define (pretty-print-constant str)
|
||||
(string-map
|
||||
(lambda (c) (if (char=? c #\_) #\- c))
|
||||
|
@ -23,20 +25,30 @@
|
|||
(else
|
||||
(error "don't know this type " type)))))
|
||||
|
||||
(define (generate-constant-list c-name scheme-name type)
|
||||
(let ((real-scheme-name (or scheme-name (pretty-print-constant c-name))))
|
||||
(format (current-output-port) "\t ~A\\n" real-scheme-name)))
|
||||
|
||||
(define (generate-comment str)
|
||||
(format (current-output-port)
|
||||
"printf(\"\\n\\n~A\\n\");~%" str))
|
||||
|
||||
(define (generate-constants const-list)
|
||||
(define (do-with-constants const-list print-func)
|
||||
(map
|
||||
(lambda (thing)
|
||||
(cond ((string? thing) (generate-comment thing))
|
||||
((list? thing)
|
||||
(generate-print-func (car thing) (cadr thing) (caddr thing)))
|
||||
(print-func (car thing) (cadr thing) (caddr thing)))
|
||||
(else
|
||||
(error "Don't know what to do with this " thing))))
|
||||
const-list))
|
||||
|
||||
(define (generate-constants const-list)
|
||||
(do-with-constants const-list generate-constants))
|
||||
|
||||
(define (generate-list-of-constants const-list)
|
||||
(do-with-constants const-list generate-constant-list))
|
||||
|
||||
(define odbc-constants-from-sql-h
|
||||
'(";;; some return values"
|
||||
("SQL_NULL_DATA" #f dec)
|
||||
|
@ -1685,3 +1697,9 @@
|
|||
(generate-constants odbc-constants-from-sqlext-h)
|
||||
(close-output-port (current-output-port))))
|
||||
|
||||
(with-output-to-file "constants.txt"
|
||||
(lambda ()
|
||||
(for-each (lambda (name)
|
||||
(format (current-output-port) "\t~A~%" name))
|
||||
clist)
|
||||
(close-output-port (current-output-port))))
|
||||
|
|
|
@ -1691,12 +1691,6 @@
|
|||
(define sql-table-stat 0)
|
||||
|
||||
|
||||
;;; Defines for SQLTables
|
||||
(define sql-all-catalogs %)
|
||||
(define sql-all-schemas %)
|
||||
(define sql-all-table-types %)
|
||||
|
||||
|
||||
;;; Options for SQLDriverConnect
|
||||
(define sql-driver-noprompt 0)
|
||||
(define sql-driver-complete 1)
|
||||
|
@ -1757,7 +1751,3 @@
|
|||
(define sql-pt-unknown 0)
|
||||
(define sql-pt-procedure 1)
|
||||
(define sql-pt-function 2)
|
||||
|
||||
|
||||
;;; This define is too large for RC (very funny!!!)
|
||||
(define sql-odbc-keywords ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,ASC,ASSERTION,AT,AUTHORIZATION,AVG,BEGIN,BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,CATALOG,CHAR,CHAR_LENGTH,CHARACTER,CHARACTER_LENGTH,CHECK,CLOSE,COALESCE,COLLATE,COLLATION,COLUMN,COMMIT,CONNECT,CONNECTION,CONSTRAINT,CONSTRAINTS,CONTINUE,CONVERT,CORRESPONDING,COUNT,CREATE,CROSS,CURRENT,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,DATE,DAY,DEALLOCATE,DEC,DECIMAL,DECLARE,DEFAULT,DEFERRABLE,DEFERRED,DELETE,DESC,DESCRIBE,DESCRIPTOR,DIAGNOSTICS,DISCONNECT,DISTINCT,DOMAIN,DOUBLE,DROP,ELSE,END,END-EXEC,ESCAPE,EXCEPT,EXCEPTION,EXEC,EXECUTE,EXISTS,EXTERNAL,EXTRACT,FALSE,FETCH,FIRST,FLOAT,FOR,FOREIGN,FORTRAN,FOUND,FROM,FULL,GET,GLOBAL,GO,GOTO,GRANT,GROUP,HAVING,HOUR,IDENTITY,IMMEDIATE,IN,INCLUDE,INDEX,INDICATOR,INITIALLY,INNER,INPUT,INSENSITIVE,INSERT,INT,INTEGER,INTERSECT,INTERVAL,INTO,IS,ISOLATION,JOIN,KEY,LANGUAGE,LAST,LEADING,LEFT,LEVEL,LIKE,LOCAL,LOWER,MATCH,MAX,MIN,MINUTE,MODULE,MONTH,NAMES,NATIONAL,NATURAL,NCHAR,NEXT,NO,NONE,NOT,NULL,NULLIF,NUMERIC,OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,ORDER,OUTER,OUTPUT,OVERLAPS,PAD,PARTIAL,PASCAL,PLI,POSITION,PRECISION,PREPARE,PRESERVE,PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PUBLIC,READ,REAL,REFERENCES,RELATIVE,RESTRICT,REVOKE,RIGHT,ROLLBACK,ROWSSCHEMA,SCROLL,SECOND,SECTION,SELECT,SESSION,SESSION_USER,SET,SIZE,SMALLINT,SOME,SPACE,SQL,SQLCA,SQLCODE,SQLERROR,SQLSTATE,SQLWARNING,SUBSTRING,SUM,SYSTEM_USER,TABLE,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEZONE_HOUR,TIMEZONE_MINUTE,TO,TRAILING,TRANSACTION,TRANSLATE,TRANSLATION,TRIM,TRUE,UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,VALUE,VALUES,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,WRITE,YEAR,ZONE)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,12 @@
|
|||
(define-structure low-odbc low-odbc-interface
|
||||
(open
|
||||
scheme external-calls scsh-utilities
|
||||
define-record-types
|
||||
conditions signals)
|
||||
(files
|
||||
odbc))
|
||||
|
||||
(define-structure low-odbc-constants low-odbc-constants-interface
|
||||
(open scheme)
|
||||
(files
|
||||
odbc-constants))
|
2484
scsh/odbc/odbc.c
2484
scsh/odbc/odbc.c
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,6 @@
|
|||
#include <stdio.h>
|
||||
|
||||
/* ODBC header files */
|
||||
|
||||
#include <sql.h>
|
||||
#include <sqlext.h>
|
||||
#include <sqltypes.h>
|
||||
|
@ -14,24 +13,9 @@
|
|||
|
||||
#define ERROR_MSG_BUFFER_LEN 255
|
||||
|
||||
#define ODBC_MAX_STR_LEN 255
|
||||
#define ODBC_MAX_DRIVER_NAME_LEN ODBC_MAX_STR_LEN
|
||||
#define ODBC_GET_INFO_MAX_LEN ODBC_MAX_STR_LEN
|
||||
#define ODBC_GET_CONNECT_ATTR_MAX_LEN ODBC_MAX_STR_LEN
|
||||
#define ODBC_GET_STMT_ATTR_MAX_LEN ODBC_MAX_STR_LEN
|
||||
#define ODBC_GET_DATA_MAX_STR_LEN ODBC_MAX_STR_LEN
|
||||
#define ODBC_DESCRIBE_COL_MAX_STR_LEN ODBC_MAX_STR_LEN
|
||||
#define ODBC_MAX_CURSOR_NAME_STR_LEN ODBC_MAX_STR_LEN
|
||||
#define ODBC_MAX_NATIVE_SQL_STR_LEN ODBC_MAX_STR_LEN
|
||||
#define ODBC_MAX_GET_DESC_FIELD_STR_LEN ODBC_MAX_STR_LEN
|
||||
|
||||
#define ODBC_RETVAL_BUFFER_INITIAL_SIZE 3
|
||||
|
||||
/* turn debug messages on/off. */
|
||||
#define ODBC_DEBUG_MSGS 1
|
||||
|
||||
#define ODBC_RAISE_EXCEPTION(MSG) s48_raise_string_os_error(MSG)
|
||||
|
||||
#ifdef ODBC_DEBUG_MSGS
|
||||
#define ODBC_DEBUG_DIAGREC(ht, h) odbc_debug_msgs(ht, h);
|
||||
#else
|
||||
|
@ -52,10 +36,43 @@
|
|||
#define ODBC_DEBUG_PRINTF_5(str, arg1, arg2, arg3, arg4) ;
|
||||
#endif
|
||||
|
||||
/* offsets for scheme records */
|
||||
/* import conditions */
|
||||
static s48_value raise_odbc_api_version_mismatch_error = S48_FALSE;
|
||||
|
||||
/* some useful macros */
|
||||
#define ODBC_SUCCESS(retval) ((retval == SQL_SUCCESS) || (retval == SQL_SUCCESS_WITH_INFO))
|
||||
#define RAISE_API_VERSION_MISMATCH(FUNNAME, APIVER, APIVERNEEDED) \
|
||||
s48_call_scheme(S48_SHARED_BINDING_REF(raise_odbc_api_version_mismatch_error), \
|
||||
3, s48_enter_string(FUNNAME), \
|
||||
s48_enter_integer(APIVER), s48_enter_integer(APIVERNEEDED));
|
||||
|
||||
static s48_value raise_odbc_unknown_integer_type_error = S48_FALSE;
|
||||
|
||||
#define RAISE_UNKNOWN_INTEGER_TYPE_ERROR(FUNNAME, TYPEID) \
|
||||
s48_call_scheme(S48_SHARED_BINDING_REF(raise_odbc_unknown_integer_type_error), \
|
||||
2, s48_enter_string(FUNNAME), s48_enter_integer(TYPEID));
|
||||
|
||||
static s48_value raise_odbc_buffer_alloc_error = S48_FALSE;
|
||||
|
||||
#define RAISE_ODBC_BUFFER_ALLOC_ERROR(BUFFERLEN) \
|
||||
s48_call_scheme(S48_SHARED_BINDING_REF(raise_odbc_buffer_alloc_error), \
|
||||
1, s48_enter_integer(BUFFERLEN));
|
||||
|
||||
static s48_value raise_odbc_unknown_c_type_identifier_error = S48_FALSE;
|
||||
|
||||
#define RAISE_ODBC_UNKNOWN_C_TYPE_IDENTIFIER_ERROR(BUFFER, TYPEID) \
|
||||
s48_call_scheme(S48_SHARED_BINDING_REF(raise_odbc_unknown_c_type_identifier_error), \
|
||||
2, s48_enter_integer(BUFFER), s48_enter_integer(TYPEID));
|
||||
|
||||
static s48_value raise_odbc_bindcol_unbound_column_error = S48_FALSE;
|
||||
|
||||
#define RAISE_ODBC_BINDCOL_UNBOUND_COLUMN_ERROR(STMTHANDLE, COLUMNNO) \
|
||||
s48_call_scheme(S48_SHARED_BINDING_REF(raise_odbc_bindcol_unbound_column_error), \
|
||||
2, s48_enter_integer(STMTHANDLE), s48_enter_integer(COLUMNNO));
|
||||
|
||||
static s48_value raise_odbc_bindcol_rebinding_error = S48_FALSE;
|
||||
|
||||
#define RAISE_ODBC_BINDCOL_REBINDING_ERROR(TEXTMSG) \
|
||||
s48_call_scheme(S48_SHARED_BINDING_REF(raise_odbc_bindcol_rebinding_error), \
|
||||
1, s48_enter_string(TEXTMSG));
|
||||
|
||||
/* corresponds to sql-date */
|
||||
static s48_value sql_date_record_type = S48_FALSE;
|
||||
|
@ -121,9 +138,6 @@ static s48_value bindcol_buffer_record_type = S48_FALSE;
|
|||
#define SR_BINDCOL_BUFFER_LENGTH 1
|
||||
#define SR_BINDCOL_BUFFER_TARGET_TYPE 2
|
||||
|
||||
static s48_value signal_unbound_column = S48_FALSE;
|
||||
static s48_value signal_buffer_exceeded = S48_FALSE;
|
||||
|
||||
typedef struct bindcol_col_rec *ColumnRecPtr;
|
||||
|
||||
typedef struct bindcol_col_rec {
|
||||
|
@ -171,7 +185,7 @@ s48_value odbc_alloc_environment_handle();
|
|||
/* given a valid environment handle (type SQLHENV) this function
|
||||
* sets the environment attributes. This needs to be done before
|
||||
* allocating a connection handle */
|
||||
void odbc_sql_set_env_attr(SQLHENV env_handle);
|
||||
s48_value odbc_sql_set_env_attr(SQLHENV env_handle);
|
||||
|
||||
/* Given a valid environment handle get a connection handle */
|
||||
s48_value odbc_alloc_connection_handle(s48_value env_handle);
|
||||
|
@ -286,12 +300,9 @@ s48_value odbc_sql_get_desc_field_string(s48_value desc_handle, s48_value rec_nu
|
|||
/* Prepare a SQL statement for execution */
|
||||
s48_value odbc_sql_prepare(s48_value stmt_handle, s48_value stmt_txt);
|
||||
|
||||
s48_value odbc_sql_bind_parameter_exec_out(s48_value stmt_handle,
|
||||
s48_value param_vals);
|
||||
|
||||
s48_value odbc_sql_get_cursor_name(s48_value stmt_handle);
|
||||
|
||||
void odbc_sql_set_cursor_name(s48_value stmt_handle, s48_value cursorname);
|
||||
s48_value odbc_sql_set_cursor_name(s48_value stmt_handle, s48_value cursorname);
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -324,8 +335,8 @@ s48_value odbc_sql_num_params(s48_value stmt_handle);
|
|||
|
||||
s48_value odbc_sql_row_count(s48_value stmt_handle);
|
||||
|
||||
s48_value odbc_sql_get_data(s48_value stmt_handle, s48_value column_number,
|
||||
s48_value target_type, s48_value buffer_size);
|
||||
s48_value odbc_sql_get_data(s48_value stmt_handle, s48_value column_number,
|
||||
s48_value target_type);
|
||||
|
||||
/* Positions a cursor within a fetched block of data and allows an application
|
||||
to refresh data in the rowset or to update or delete data in the result
|
||||
|
@ -486,6 +497,16 @@ s48_value struct_to_sql_time_record(SQL_TIME_STRUCT *ts);
|
|||
void sql_timestamp_record_to_struct(s48_value sql_timestamp,
|
||||
SQL_TIMESTAMP_STRUCT *ts);
|
||||
|
||||
/* initial return value buffer size */
|
||||
#define ODBC_RETVAL_BUFFER_DEFAULT_SIZE 255
|
||||
static SQLUSMALLINT odbc_initial_retval_buffer_size = ODBC_RETVAL_BUFFER_DEFAULT_SIZE;
|
||||
|
||||
/* set initial return value buffer size */
|
||||
s48_value odbc_set_initial_retval_buffer_size(s48_value nobytes);
|
||||
|
||||
/* get initial return value buffer size */
|
||||
s48_value odbc_get_intial_retval_buffer_size();
|
||||
|
||||
void odbc_sql_alloc(void **buffer, size_t buffer_len, size_t type_len);
|
||||
|
||||
size_t sizeof_sql_c_type_identifier(SQLSMALLINT ctypeid);
|
||||
|
|
|
@ -63,6 +63,94 @@
|
|||
(else
|
||||
(error "Unknown handle type: " record))))
|
||||
|
||||
;;; conditions
|
||||
(define-condition-type 'odbc-error '(error))
|
||||
|
||||
(define odbc-error?
|
||||
(condition-predicate 'odbc-error))
|
||||
|
||||
(define-condition-type 'odbc-api-version-mismatch '(odbc-error))
|
||||
|
||||
(define odbc-api-version-mismatch?
|
||||
(condition-predicate 'odbc-api-version-mismatch))
|
||||
|
||||
(define (raise-odbc-api-version-mismatch-error function-name
|
||||
api-version
|
||||
api-version-needed)
|
||||
(apply signal 'odbc-api-version-mismatch
|
||||
'function-name function-name
|
||||
'odbc-driver-manager-api-version api-version
|
||||
'min-api-version-required api-version-needed))
|
||||
|
||||
(define-exported-binding
|
||||
"raise-odbc-api-version-mismatch-error"
|
||||
raise-odbc-api-version-mismatch-error)
|
||||
|
||||
;;;
|
||||
(define-condition-type 'odbc-unknown-integer-type '(odbc-error))
|
||||
|
||||
(define odbc-unknown-integer-type?
|
||||
(condition-predicate 'odbc-unknown-integer-type))
|
||||
|
||||
(define (raise-odbc-unknown-integer-type-error function-name type-id)
|
||||
(apply signal 'odbc-unknown-integer-type
|
||||
'function-name function-name 'type-id type-id))
|
||||
|
||||
(define-exported-binding
|
||||
"raise-odbc-unknown-integer-type-error" raise-odbc-unknown-integer-type-error)
|
||||
|
||||
;;;
|
||||
(define-condition-type 'odbc-buffer-alloc-error '(odbc-error))
|
||||
|
||||
(define odbc-buffer-alloc-error?
|
||||
(condition-predicate 'odbc-buffer-alloc-error))
|
||||
|
||||
(define (raise-odbc-buffer-alloc-error buffer-length)
|
||||
(apply signal 'odbc-buffer-alloc-error 'buffer-length buffer-length))
|
||||
|
||||
(define-exported-binding
|
||||
"raise-odbc-buffer-alloc-error" raise-odbc-buffer-alloc-error)
|
||||
|
||||
;;;
|
||||
(define-condition-type 'odbc-unknown-c-type-identifier-error '(odbc-error))
|
||||
|
||||
(define odbc-unknown-c-type-identifier-error?
|
||||
(condition-predicate 'odbc-unknown-c-type-identifier-error))
|
||||
|
||||
(define (raise-odbc-unknown-c-type-identifier-error buffer ctypeid)
|
||||
(apply signal 'odbc-unknown-c-type-identifier-error
|
||||
'buffer buffer 'ctypeid ctypeid))
|
||||
|
||||
(define-exported-binding
|
||||
"raise-odbc-unknown-c-type-identifier-error"
|
||||
raise-odbc-unknown-c-type-identifier-error)
|
||||
|
||||
;;;
|
||||
(define-condition-type 'odbc-bindcol-unbound-column '(odbc-error))
|
||||
|
||||
(define odbc-bindcol-unbound-column-error?
|
||||
(condition-predicate 'odbc-bindcol-unbound-column))
|
||||
|
||||
(define (raise-odbc-bindcol-unbound-column-error stmt-handle column-no)
|
||||
(apply signal 'odbc-bindcol-unbound-column
|
||||
'statement-handle stmt-handle 'column-no column-no))
|
||||
|
||||
(define-exported-binding "raise-odbc-bindcol-unbound-column-error"
|
||||
raise-odbc-bindcol-unbound-column-error)
|
||||
|
||||
;;;
|
||||
(define-condition-type 'odbc-bindcol-rebinding-error '(odbc-error))
|
||||
|
||||
(define odbc-bindcol-rebinding-error?
|
||||
(condition-predicate 'odbc-bindcol-rebinding-error))
|
||||
|
||||
(define (raise-odbc-bindcol-rebinding-error text-msg)
|
||||
(apply signal 'odbc-bindcol-rebinding-error text-msg))
|
||||
|
||||
(define-exported-binding "raise-odbc-bindcol-rebinding-error"
|
||||
raise-odbc-bindcol-rebinding-error)
|
||||
|
||||
;;;
|
||||
(define-record-type odbc-column :odbc-column
|
||||
(really-make-odbc-column name type size digits nullable?)
|
||||
odbc-column?
|
||||
|
@ -456,34 +544,32 @@
|
|||
(define sql-invalid-handle -2)
|
||||
(define sql-need-data 99)
|
||||
|
||||
(define-record-type odbc-column :odbc-column
|
||||
(really-make-odbc-column name type size digits nullable)
|
||||
odbc-column?
|
||||
(name odbc-column-name)
|
||||
(type odbc-column-type)
|
||||
(size odbc-column-size)
|
||||
(digits odbc-column-digits)
|
||||
(nullable odbc-column-nullable))
|
||||
|
||||
;;; PART 1
|
||||
|
||||
(define (odbc-alloc-environment-handle)
|
||||
(let ((env-handle (really-make-environment-handle
|
||||
(odbc-alloc-environment-handle-internal))))
|
||||
(add-finalizer! env-handle odbc-sql-free-handle)
|
||||
env-handle))
|
||||
(let* ((status.value (odbc-alloc-environment-handle-internal))
|
||||
(status (car status.value))
|
||||
(value (cadr status.value)))
|
||||
(if (odbc-call-successful? status)
|
||||
(let ((env-handle (really-make-environment-handle value)))
|
||||
(add-finalizer! env-handle odbc-sql-free-handle)
|
||||
(values status env-handle))
|
||||
(values status value))))
|
||||
|
||||
(import-lambda-definition odbc-alloc-environment-handle-internal
|
||||
()
|
||||
"odbc_alloc_environment_handle")
|
||||
|
||||
(define (odbc-alloc-connection-handle env-handle)
|
||||
(check-arg environment-handle? env-handle odbc-alloc-connection-handle)
|
||||
(let ((conn-handle (really-make-connection-handle
|
||||
(odbc-alloc-connection-handle-internal
|
||||
(environment-handle-handle env-handle)) env-handle #f)))
|
||||
(add-finalizer! conn-handle free-connection-handle)
|
||||
conn-handle))
|
||||
(let* ((status.value (odbc-alloc-connection-handle-internal
|
||||
(environment-handle-handle env-handle)))
|
||||
(status (car status.value))
|
||||
(value (cadr status.value)))
|
||||
(if (odbc-call-successful? status)
|
||||
(let ((conn-handle (really-make-environment-handle value)))
|
||||
(add-finalizer! conn-handle free-connection-handle)
|
||||
(values status conn-handle))
|
||||
(values status value))))
|
||||
|
||||
(import-lambda-definition odbc-alloc-connection-handle-internal
|
||||
(env-handle)
|
||||
|
@ -496,19 +582,20 @@
|
|||
(odbc-sql-free-handle conn-handle))
|
||||
|
||||
(define (odbc-alloc-statement-handle conn-handle)
|
||||
(check-arg connection-handle? conn-handle odbc-alloc-statement-handle)
|
||||
(let ((stmt-handle (really-make-statement-handle
|
||||
(odbc-alloc-statement-handle-internal
|
||||
(connection-handle-handle conn-handle))
|
||||
conn-handle)))
|
||||
(add-finalizer! stmt-handle free-statement-handle)
|
||||
stmt-handle))
|
||||
(let* ((status.value (odbc-alloc-statement-handle-internal
|
||||
(connection-handle-handle conn-handle)))
|
||||
(status (car status.value))
|
||||
(value (cadr status.value)))
|
||||
(if (odbc-call-successful? status)
|
||||
(let ((stmt-handle (really-make-statement-handle value)))
|
||||
(add-finalizer! stmt-handle free-statement-handle)
|
||||
(values status stmt-handle))
|
||||
(values status value))))
|
||||
|
||||
(define (free-statement-handle stmt-handle)
|
||||
(bindcol-finalize-bindcols (statement-handle-handle stmt-handle))
|
||||
(odbc-sql-free-handle stmt-handle))
|
||||
|
||||
|
||||
(import-lambda-definition odbc-alloc-statement-handle-internal
|
||||
(db-handle)
|
||||
"odbc_alloc_statement_handle")
|
||||
|
@ -519,7 +606,6 @@
|
|||
|
||||
;;; returns odbc-return-value
|
||||
(define (odbc-sql-connect conn-handle server-name user-name auth)
|
||||
(check-arg connection-handle? conn-handle odbc-sql-connect)
|
||||
(let ((return-value (odbc-sql-connect-internal
|
||||
(connection-handle-handle conn-handle)
|
||||
server-name user-name auth)))
|
||||
|
@ -532,10 +618,10 @@
|
|||
"odbc_sql_connect")
|
||||
|
||||
(define (odbc-sql-browse-connect conn-handle connection-string)
|
||||
(check-arg connection-handle? conn-handle odbc-sql-browse-connect)
|
||||
(odbc-sql-browse-connect-internal (connection-handle-handle conn-handle)
|
||||
connection-string))
|
||||
|
||||
(apply values
|
||||
(odbc-sql-browse-connect-internal
|
||||
(connection-handle-handle conn-handle) connection-string)))
|
||||
|
||||
(import-lambda-definition odbc-sql-browse-connect-internal
|
||||
(conn-handle connection-string)
|
||||
"odbc_sql_browse_connect")
|
||||
|
@ -543,48 +629,53 @@
|
|||
;;; PART 2
|
||||
|
||||
(define (odbc-sql-data-sources env-handle)
|
||||
(check-arg environment-handle? env-handle odbc-sql-data-sources)
|
||||
(reverse (odbc-sql-data-sources-internal (environment-handle-handle env-handle))))
|
||||
(apply values
|
||||
(odbc-sql-data-sources-internal
|
||||
(environment-handle-handle env-handle))))
|
||||
|
||||
(import-lambda-definition odbc-sql-data-sources-internal
|
||||
(env-handle)
|
||||
"odbc_sql_data_sources")
|
||||
|
||||
(define (odbc-sql-drivers env-handle)
|
||||
(check-arg environment-handle? env-handle odbc-sql-drivers)
|
||||
(odbc-sql-drivers-internal (environment-handle-handle env-handle)))
|
||||
(apply values
|
||||
(odbc-sql-drivers-internal
|
||||
(environment-handle-handle env-handle))))
|
||||
|
||||
(import-lambda-definition odbc-sql-drivers-internal
|
||||
(env-handle)
|
||||
"odbc_sql_drivers")
|
||||
|
||||
(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))
|
||||
(apply values
|
||||
(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")
|
||||
|
||||
(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))
|
||||
(apply values
|
||||
(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")
|
||||
|
||||
(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))
|
||||
(apply values
|
||||
(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")
|
||||
|
||||
(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))
|
||||
(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)
|
||||
|
@ -593,90 +684,85 @@
|
|||
;;; PART 3
|
||||
|
||||
(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))
|
||||
(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")
|
||||
|
||||
(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))
|
||||
(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")
|
||||
|
||||
(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))
|
||||
|
||||
(apply values
|
||||
(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")
|
||||
|
||||
(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))
|
||||
(apply values
|
||||
(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")
|
||||
|
||||
(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))
|
||||
(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")
|
||||
|
||||
(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))
|
||||
(apply values
|
||||
(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")
|
||||
|
||||
(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))
|
||||
(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")
|
||||
|
||||
(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))
|
||||
(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")
|
||||
|
||||
(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))
|
||||
(apply values
|
||||
(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")
|
||||
|
||||
(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))
|
||||
(apply values
|
||||
(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)
|
||||
|
@ -685,18 +771,18 @@
|
|||
;;; PART 4
|
||||
|
||||
(define (odbc-sql-get-desc-field-int desc-handle record-number field-id)
|
||||
(check-arg descriptor-handle? desc-handle odbc-sql-get-desc-field-int)
|
||||
(odbc-sql-get-desc-field-int-internal (descriptor-handle-handle desc-handle)
|
||||
record-number field-id))
|
||||
(apply values
|
||||
(odbc-sql-get-desc-field-int-internal
|
||||
(descriptor-handle-handle desc-handle) record-number field-id)))
|
||||
|
||||
(import-lambda-definition odbc-sql-get-desc-field-int-internal
|
||||
(desc-handle record-number field-id)
|
||||
"odbc_sql_get_desc_field_int")
|
||||
|
||||
(define (odbc-sql-get-desc-field-string desc-handle record-number field-id)
|
||||
(check-arg descriptor-handle? desc-handle odbc-sql-get-desc-field-string)
|
||||
(odbc-sql-get-desc-field-string-internal (descriptor-handle-handle desc-handle)
|
||||
record-number field-id))
|
||||
(apply values
|
||||
(odbc-sql-get-desc-field-string-internal
|
||||
(descriptor-handle-handle desc-handle) record-number field-id)))
|
||||
|
||||
(import-lambda-definition odbc-sql-get-desc-field-string-internal
|
||||
(desc-handle record-number field-id)
|
||||
|
@ -705,34 +791,25 @@
|
|||
;;; PART 5
|
||||
|
||||
(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))
|
||||
(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")
|
||||
|
||||
(define (odbc-sql-bind-parameter-exec-out stmt-handle param-vals)
|
||||
(check-arg statement-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")
|
||||
|
||||
(define (odbc-sql-get-cursor-name stmt-handle)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-get-cursor-name)
|
||||
(odbc-sql-get-cursor-name-internal (statement-handle-handle stmt-handle)))
|
||||
(apply values
|
||||
(odbc-sql-get-cursor-name-internal
|
||||
(statement-handle-handle stmt-handle))))
|
||||
|
||||
(import-lambda-definition odbc-sql-get-cursor-name-internal
|
||||
(stmt-handle)
|
||||
"odbc_sql_get_cursor_name")
|
||||
|
||||
(define (odbc-sql-set-cursor-name stmt-handle cursor-name)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-set-cursor-name)
|
||||
(odbc-sql-set-cursor-name-internal (statement-handle-handle stmt-handle) cursor-name))
|
||||
(odbc-sql-set-cursor-name-internal
|
||||
(statement-handle-handle stmt-handle) cursor-name))
|
||||
|
||||
(import-lambda-definition odbc-sql-set-cursor-name-internal
|
||||
(stmt-handle cursor-name)
|
||||
|
@ -741,7 +818,6 @@
|
|||
;;; PART 6
|
||||
|
||||
(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
|
||||
|
@ -749,35 +825,35 @@
|
|||
"odbc_sql_execute")
|
||||
|
||||
(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))
|
||||
(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")
|
||||
|
||||
(define (odbc-sql-native-sql conn-handle stmt-txt)
|
||||
(check-arg connection-handle? conn-handle odbc-sql-native-sql)
|
||||
(odbc-sql-native-sql-internal (connection-handle-handle conn-handle)
|
||||
stmt-txt))
|
||||
(apply values
|
||||
(odbc-sql-native-sql-internal
|
||||
(connection-handle-handle conn-handle) stmt-txt)))
|
||||
|
||||
(import-lambda-definition odbc-sql-native-sql-internal
|
||||
(conn-handle stmt-txt)
|
||||
"odbc_sql_native_sql")
|
||||
|
||||
(define (odbc-sql-describe-param stmt-handle parameter-no)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-describe-param)
|
||||
(odbc-sql-describe-param-internal (statement-handle-handle stmt-handle)
|
||||
parameter-no))
|
||||
(apply values
|
||||
(odbc-sql-describe-param-internal
|
||||
(statement-handle-handle stmt-handle) parameter-no)))
|
||||
|
||||
(import-lambda-definition odbc-sql-describe-param-internal
|
||||
(stmt-handle parameter-no)
|
||||
"odbc_sql_describe_param")
|
||||
|
||||
(define (odbc-sql-num-params stmt-handle)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-num-params)
|
||||
(odbc-sql-num-params-internal (statement-handle-handle stmt-handle)))
|
||||
(apply values
|
||||
(odbc-sql-num-params-internal
|
||||
(statement-handle-handle stmt-handle))))
|
||||
|
||||
(import-lambda-definition odbc-sql-num-params-internal
|
||||
(stmt-handle)
|
||||
|
@ -786,51 +862,49 @@
|
|||
;;; PART 7
|
||||
|
||||
(define (odbc-sql-row-count stmt-handle)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-row-count)
|
||||
(odbc-sql-row-count-internal (statement-handle-handle stmt-handle)))
|
||||
(apply values
|
||||
(odbc-sql-row-count-internal
|
||||
(statement-handle-handle stmt-handle))))
|
||||
|
||||
(import-lambda-definition odbc-sql-row-count-internal
|
||||
(stmt-handle)
|
||||
"odbc_sql_row_count")
|
||||
|
||||
(define (odbc-sql-get-data stmt-handle column-number target-type buffer-size)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-get-data)
|
||||
(define (odbc-sql-get-data stmt-handle column-number target-type)
|
||||
(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 buffer-size)
|
||||
(stmt-handle column-number target-type)
|
||||
"odbc_sql_get_data")
|
||||
|
||||
(define (odbc-sql-set-pos stmt-handle row-number operation lock-type)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-set-pos)
|
||||
(odbc-sql-set-pos-internal (statement-handle-handle stmt-handle)
|
||||
row-number operation lock-type))
|
||||
(odbc-sql-set-pos-internal
|
||||
(statement-handle-handle stmt-handle) row-number operation lock-type))
|
||||
|
||||
(import-lambda-definition odbc-sql-set-pos-internal
|
||||
(stmt-handle row-number operation lock-type)
|
||||
"odbc_sql_set_pos")
|
||||
|
||||
(define (odbc-sql-bulk-operations stmt-handle operation)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-bulk-operations)
|
||||
(odbc-sql-bulk-operations-internal (statement-handle-handle stmt-handle)
|
||||
operation))
|
||||
(odbc-sql-bulk-operations-internal
|
||||
(statement-handle-handle stmt-handle) operation))
|
||||
|
||||
(import-lambda-definition odbc-sql-bulk-operations-internal
|
||||
(stmt-handle operation)
|
||||
"odbc_sql_bulk_operations")
|
||||
|
||||
(define (odbc-sql-more-results stmt-handle)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-more-results)
|
||||
(odbc-sql-more-results-internal (statement-handle-handle stmt-handle)))
|
||||
(odbc-sql-more-results-internal
|
||||
(statement-handle-handle stmt-handle)))
|
||||
|
||||
(import-lambda-definition odbc-sql-more-results-internal
|
||||
(stmt-handle)
|
||||
"odbc_sql_more_results")
|
||||
|
||||
(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)))
|
||||
(odbc-sql-fetch-internal
|
||||
(statement-handle-handle stmt-handle)))
|
||||
|
||||
(import-lambda-definition odbc-sql-fetch-internal
|
||||
(stmt-handle)
|
||||
|
@ -942,7 +1016,7 @@
|
|||
(stmt-handle catalog-name schema-name table-type table-type)
|
||||
"odbc_sql_tables")
|
||||
|
||||
;;; part 9
|
||||
;;; PART 9
|
||||
|
||||
(define (odbc-sql-free-statement stmt-handle option)
|
||||
(check-arg statement-handle? stmt-handle odbc-sql-free-statement)
|
||||
|
@ -1029,6 +1103,14 @@
|
|||
(handle-type handle)
|
||||
"odbc_sql_get_diag_recs")
|
||||
|
||||
(import-lambda-definition odbc-set-initial-retval-buffer-size
|
||||
(no-bytes)
|
||||
"odbc_set_initial_retval_buffer_size")
|
||||
|
||||
(import-lambda-definition odbc-get-initial-retval-buffer-size
|
||||
()
|
||||
"odbc_get_intial_retval_buffer_size")
|
||||
|
||||
;;; misc stuff
|
||||
(define (odbc-call-successful? odbc-return-value)
|
||||
(or (equal? odbc-return-value sql-success)
|
||||
|
|
|
@ -26,8 +26,8 @@ their own drivers.
|
|||
The \textit{Data Source Name}, DSN for short, associates credentials
|
||||
needed to logon a certain database with a the apropriate driver to
|
||||
access that database. If an application wishes to connect to a DSN
|
||||
the driver manager loads the ##angegeben## driver and routes all
|
||||
functions call by the application via this driver to the database.
|
||||
the driver manager loads the specified driver and routes all functions
|
||||
call by the application via this driver to the database.
|
||||
|
||||
The are at least two implementation of ODBC driver managers for UNIX
|
||||
systems: unixODBC~\cite{BlaBla} and iODBC~\cite{BlaBla}. The Scheme
|
||||
|
@ -37,8 +37,8 @@ during compilation of scsh which one to use.
|
|||
Support for ODBC at this time is quite low-level---for alsmost each
|
||||
function or data structure in the ODBC API there is a function call in
|
||||
Scheme. This chapter describes how to call the API functions from
|
||||
Scheme, but does not cover the ##funktionsweise## of the underlying
|
||||
ODBC function call in detail. Microsoft's ODBC API reference
|
||||
Scheme, but does not cover the functionality of the underlying ODBC
|
||||
function call in detail. Microsoft's ODBC API reference
|
||||
manual~\cite{BlaBla} explains all API functions in great detail.
|
||||
|
||||
\section{ODBC Data Types}
|
||||
|
|
Loading…
Reference in New Issue