[postmodern-devel] dao and *escape-sql-names-p*
Gavin Scott
gavindscott at gmail.com
Sun Mar 30 02:57:49 UTC 2008
Hello,
It appears that setting *escape-sql-names-p* breaks dao objects a bit.
If it is t when defclass is called, calling get-dao on that class
will result in an error from build-row-reader like "Field field does
not exist in table class TABLE-CLASS", even though field does indeed
exist. This is because slot-sql-name will return a quoted copy of the
field name due to *escape-sql-names-p*.
A fix is to change direct-column-slot's shared-initialize method to
use s-sql:make-sql-name rather than to-sql-name; make-sql-name doesn't
quote the column name. However, make-sql-name would then need to be
exported by s-sql.
A somewhat related issue is that the dao documentation example:
http://common-lisp.net/project/postmodern/postmodern.html#daos
(defclass user () ... )
has problems if *escape-sql-names-p* is not set since user is an sql
keyword. I personally would prefer to see *escape-sql-names-p* set as
the default, which would fix this issue. Another solution would be to
pick a different example class name or to set *escape-sql-names-p*.
Thanks,
Gavin Scott
gavindscott at gmail.com
More information about the postmodern-devel
mailing list