
;;; condition to signal that the buffer was too small
(define-condition-type 'odbc-buffer-exceeded '(error))
(define odbc-buffer-exceeded? 
  (condition-predicate 'odbc-buffer-exceeded))

(define (signal-buffer-exceeded buffer-needed buffer-contents)
  (signal 'odbc-buffer-exceeded buffer-needed buffer-contents))

(define-exported-binding "signal-buffer-exceeded" signal-buffer-exceeded)

;;; tried lookup for a column that is not bound
(define-condition-type 'odbc-unbound-column '(error))
(define odbc-unbound-column?
  (condition-predicate 'odbc-unbound-column))

(define (signal-unbound-column stmt-handle column-no)
  (signal 'odbc-unbound-column stmt-handle column-no))

(define-exported-binding "signal-unbound-column" signal-unbound-column)

(define (odbc-sql-bindcol stmt-handle column-no target-type buffer-len)
  (check-arg statement-handle? stmt-handle odbc-sql-bindcol)
  (let ((handle (statement-handle-handle stmt-handle)))
    (odbc-sql-bindcol-internal handle column-no target-type buffer-len)
    (lambda ()
      (bindcol-lookup-binding-scheme handle column-no))))

(import-lambda-definition odbc-sql-bindcol-internal
			  (stmt-handle column-no target-type buffer-len)
			  "odbc_sql_bindcol")

(import-lambda-definition bindcol-lookup-binding-scheme
			  (stmt-handle column-no)
			  "bindcol_lookup_binding_scheme")


