[elephant-devel] Elephant 0.6.0 SQL fix on OpenMCL 1.0

George Khouri gk1 at four-four.com
Sat Nov 4 11:18:27 UTC 2006


Friends,
Testing  Elephant 0.6.0 against a postgres db, in OpenMCL 1.0, I found that the close-cursor method fails since it tries to set the value of the sql-cursor slot "curkey" to NIL, while its type spec in the class declaration is INTEGER.  Perhaps other lisps allow this.  
If I change close-cursor to set curkey to -1 as below, the tests run fine.  I don't know if there are other routines which check for a null value in that cursor slot, in which case my change wouldn't work. Perhaps the type spec should be removed from the slot declaration instead?

The code is in elephant/src/db-clsql/sql-collections.lisp.

(defclass sql-cursor (cursor)
  ((keys :accessor :sql-crsr-ks :initarg :sql-cursor-keys :initform '())
   (curkey :accessor :sql-crsr-ck :initarg :sql-cursor-curkey :initform -1 :type integer))
  (:documentation "A SQL cursor for traversing (primary) BTrees."))

...

(defmethod cursor-close ((cursor sql-cursor))
  #-openmcl
  (setf (:sql-crsr-ck cursor) nil)
  #+openmcl 
  (setf (:sql-crsr-ck cursor) -1)  ; ** GK  
  (setf (cursor-initialized-p cursor) nil))

Thanks,
George
--------
George Khouri
gk1 at four-four.com



More information about the elephant-devel mailing list