[PATCH] Joins selection bug

Vladimir Sekissov <[email protected]> Thu, 03 Aug 2006 01:41:36 +0600 (YEKST)
Newsgroups gmane.lisp.clsql.devel
Message-ID <[email protected]>
Good day,

Before this patch JOIN-QUALIFIER ignored declared type of home slot on
value formatting. This could cause wrong results  for foreign keys
different from integers.

Patch was tested with CLSQL-3.6.0 on PostgreSQL.

Best Regards,
Vladimir Sekissov

--- sql/oodml.lisp.orig	2005-10-31 09:21:00.000000000 +0500
+++ sql/oodml.lisp	2006-08-03 01:26:42.000000000 +0600
@@ -797,7 +797,7 @@
 	       res)))))))
 
 (defun join-qualifier (class object slot-def)
-    (declare (ignore class))
+    ;;(declare (ignore class))
     (let* ((dbi (view-class-slot-db-info slot-def))
 	   (jc (find-class (gethash :join-class dbi)))
 	   ;;(ts (gethash :target-slot dbi))
@@ -821,7 +821,9 @@
                                               (t fk))
                                             (typecase hk
                                               (symbol
-                                               (slot-value object hk))
+                                               (db-value-from-slot (slotdef-for-slot-with-class hk class)
+                                                                   (slot-value object hk)
+                                                                   (or (view-database object) *default-database*)))
                                               (t
                                                hk)))))
                        (if (listp home-keys)