[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SchemeQL



MichaelL@frogware.com writes:

> When I try the following in "103.5":
>
>         (define odbc-version 3.51)
>         (require-library "schemeql.ss" "schemeql")
>
> I get:
>
>         unit: used an unbound or non-primitive global in: get-diag-field

[...]

> On a hunch I tried changing odbc-version to 2.5 and it (SchemeQL) worked. 
> (I actually have 3.52, so the problem isn't on the ODBC side. And FYI 
> odbc-version 3.0 also fails.)

The problem is that `get-diag-field' is the preferred way to handle
errors in ODBC drivers level 3.0 and up.  And according to the
documentation (doc.txt) that comes with SrPersist, both
`get-diag-field', and `get-diag-rec' are provided if odbc-version is
greater than 3.0:

,--------------------
| > (get-diag-field handle recnum field) 
| 
|  ODBC 3.0.
| 
| > (get-diag-rec handle recnum) 
|  
|  ODBC 3.0.
`--------------------

(Nevertheless, I've never been able to test them, the biggest
ODBC-level I've used is 2.5 (2.0), sorry.)

I wonder: did you compile yourself SrPersist? Maybe the problem is
that it was compiled with an ODBCVER less than 0x300, and thus the
library isn't providing those procedures.  If this is the case, and if
sql-error is still supported by your ODBC driver:

,--------------------
| > (sql-error henv hdbc hstmt)
| 
|  ODBC 1.0, deprecated in favor of get-diag-rec.
`--------------------

then, `schemeql-diagnostic-center' should be:

(define schemeql-diagnostic-center
  (lambda ()
    (let ((hdbc (gensym)) (henv (gensym)) (hstmt (gensym)))
      `(lambda (,hdbc ,henv ,hstmt)
	 (list (sql-error (or ,henv  (database-henv (current-database)))
			  (or ,hdbc  'sql-null-hdbc)
			  (or ,hstmt 'sql-null-hstmt)))))))


[...]

OTOH, I have found a good number of shortcomings with the way SchemeQL
works, and I'm planning to re-design, and implement a new SchemeQL,
taking into consideration much of the things that Noel, and others
pointed out here a while ago.  Unfortunately, I don't have time right
now, and that will have to wait until January.

HTH,
--Francisco