[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SchemeQL problem
"Chris Double" <chris@double.co.nz> writes:
> > Try schemeql out of CVS.
> >
> > (I'm the reason the problem is a known one.)
>
> Thanks, will do. I think I found the source of my original problem. If I do
> the following I get the same error as I reported with SchemeQL:
>
> (require (lib "srpersist.ss" "srpersist"))
> (alloc-handle 'sql-handle-dbc (alloc-handle 'sql-handle-env))
> => Unspecified error in alloc-handle
Here's some scaffolding I use to avoid those "unspecified" messages:
(define (srpersist-exn? exn)
(or (exn-with-info? exn)
(exn-need-data? exn)
(exn-no-data? exn)
(exn-invalid-handle? exn)
(exn-error? exn)
(exn-still-executing? exn)))
(define (my-get-diag-rec exn handle no)
(with-handlers
([(lambda (exn) (exn-no-data? exn))
(lambda (exn) (printf "~a~n" (exn-message exn)))])
(if (exn-with-info? exn)
(printf "~a~n" (exn-with-info-val exn)))
(printf "~a~n" (get-diag-rec handle no))))
(define (make-handler handle)
(lambda (exn)
(printf "~a~n" (exn-message exn))
(my-get-diag-rec exn handle 1))) ;; I never get more than one.
(define (my-alloc-handle htype handle)
(let ((handler (make-handler handle)))
(with-handlers
([srpersist-exn? handler])
(alloc-handle htype handle))))
(define (my-connect hdbc dbms name password)
(let ((handler (make-handler hdbc)))
(with-handlers
([srpersist-exn? handler])
(connect hdbc dbms name password))))
Now, I can do this:
> (require (lib "srpersist.ss" "srpersist"))
> (define x (alloc-handle 'sql-handle-env))
> (define hdbc (my-alloc-handle 'sql-handle-dbc x))
Unspecified error in alloc-handle
("HY010" 0 "[unixODBC][Driver Manager]Function sequence error")
Not that this makes me any wiser :-). But for other condtitions, it might.
Regards
Jon Kåre
--
Jon Kåre Hellan Trondheim
Clustra AS Norway