Re: MySQL error handling bug

"Christopher C. Stacy" <[email protected]> Thu, 26 Jun 2003 01:24:44 -0400 (EDT)
Newsgroups gmane.lisp.clsql.general,gmane.lisp.uffi.general
Message-ID <[email protected]>
>>>>> On Wed, 25 Jun 2003 00:39:11 -0400 (EDT), cstacy C Stacy ("cstacy") writes:
 cstacy> I'm in Lispworks for Windows 4.1 with CL-SQL 1.5.4 (but the 
 cstacy> latest 1.6.6 files look the same here) and UFFI 1.2.15, 
 cstacy> talking to some mySQL server on Linux.

 cstacy> There seems to be a bug in the file "mysql-api".
 cstacy> MYSQL-ERROR-STRING always blows up with:
 cstacy>  The subscript 0 exceeds the limit -1 for the first dimension
 cstacy>  of the foreign-array #<Foreign-Array (:UNSIGNED :CHAR) (0): addr #x01BC0064>.

Looking at this a little closer, the problem seems to have something
to do with some confusion about what to do with that foreign pointer.

In UFFI, (strings.lisp,v 1.7 2003/03/28 19:58:18 kevin Exp)
the macro CONVERT-FROM-CSTRING simply returns its given argument.
The comment there says:

  "Converts a string from a c-call.  Same as CONVERT-FROM-FOREIGN-STRING, 
   except that LW/CMU automatically converts strings from c-calls."

However, CONVERT-FROM-FOREIGN-STRING is defined a little further on,
and seemingly contrary to the above comment, it sure does do something!
It calls FLI:CONVERT-TO-FOREIGN-STRING.

If I pass the above pointer to CONVERT-FROM-FOREIGN-STRING, I get the
nice Lisp string that gives me the desired SQL error message.

I'm not sure what that comment is supposed to mean.  
I don't know if this represents a bug in the definition of 
the mySQL library interface in CL-SQL, or a bug in UFFI.
Does anyone understand what's going on here?

I'm running UFFI 1.2.15, but the latest (1.2.16) UFFI code 
looks like it does the same thing.

Thanks!

Chris