[cl-debian] Bug#352567: cl-sql and :db-reader
Thomas Fischbacher
Thomas.Fischbacher at Physik.Uni-Muenchen.DE
Sun Feb 12 18:41:02 UTC 2006
Package: cl-sql
Version: 3.1.2-1
There are three problems with the :db-reader argument to DEF-VIEW-CLASS:
(1) Documentation bug:
It is mentioned in the documentation in the example page
/usr/share/doc/cl-sql/html/ch02s02.html
but not in the documentation of def-view-class itself:
/usr/share/doc/cl-sql/html/def-view-class.html
(2) Code bug:
sql/metaclasses.lisp contains a piece of code in
(defmethod compute-effective-slot-definition ((class standard-db-class)
#+kmr-normal-cesd slot-name
direct-slots)
that deals with the :db-writer slot:
(setf (slot-value esd 'db-writer)
(when (slot-boundp dsd 'db-writer)
(delistify-dsd (view-class-slot-db-writer dsd))))
The corresponding piece of code for :db-reader is just missing. Patching
in these lines will make the code work (at least that's what I observe):
(setf (slot-value esd 'db-reader)
(when (slot-boundp dsd 'db-reader)
(delistify-dsd (view-class-slot-db-reader dsd))))
(3) Usage bug(?):
Specifying a function as a reader argument is quite awkward. Right
now, I am using #. syntax:
(content
:db-kind :base
:column "ser_content"
:db-constraints :not-null
:accessor msg-content
:db-type "text" ; postgres
:db-reader #.#'_msg-deserialize-content
:db-writer #.#'_msg-serialize-content
:initarg :content)
That is presumably not what's intended here. Maybe I just did not get the
point, but somehow I seem to be unable to properly specify a function in
this place. If this really is not possible, it would at least be nice if
one could specify a symbol whose symbol-function is the desired
de-serialization function.
On a side note, the documentation could be a bit clearer on the proper way
to type-map a postgresql variable-length "text" field to CLOS. I think the
method I am using above should presumably be okay.
--
regards, tf at cip.physik.uni-muenchen.de (o_
Thomas Fischbacher - http://www.cip.physik.uni-muenchen.de/~tf //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y) V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1)) (Debian GNU)
More information about the Cl-debian
mailing list