cl-postgres convert nil to false

Julien Danjou julien at danjou.info
Sun Jul 28 14:17:46 UTC 2013


On Fri, Jul 26 2013, Julien Danjou wrote:

> Does that sounds like a good idea, or do I miss an obvious problem?

For the record and people interested in that hack, I really find it
quite handy in the end. And it's easy enough to change cl-postgres/s-sql
behaviour:

(defmethod s-sql:sql-escape ((arg symbol))
  "Overrides the s-sql provided function so it handles correctly the :false
keyword and get it converted to false."
  (if (or (typep arg 'boolean) (eq arg :null) (eq arg :false))
      (call-next-method)
      (s-sql:to-sql-name arg)))

(defmethod cl-postgres:to-sql-string ((arg (eql nil)))
  "Overrides the cl-postgres provided function so it handles nil as NULL instead of false."
  "NULL")

(defmethod cl-postgres:to-sql-string ((arg (eql :false)))
  "Overrides the cl-postgres provided function so it handles :false."
  "false")

-- 
Julien Danjou
;; Free Software hacker ; freelance consultant
;; http://julien.danjou.info
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/postmodern-devel/attachments/20130728/a3c0c2f9/attachment.sig>


More information about the postmodern-devel mailing list