From 051f4d2f472406fa381e20d2da0cf25f091f262a Mon Sep 17 00:00:00 2001 From: Russ Tyndall Date: Mon, 18 Jan 2010 11:21:48 -0500 Subject: [PATCH] command-objects: made nil be treated as "null" in the database by default instead of "false". To pass false use :false or :f --- sql/command-object.lisp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sql/command-object.lisp b/sql/command-object.lisp index 1a9cc3e..f6c5769 100644 --- a/sql/command-object.lisp +++ b/sql/command-object.lisp @@ -32,6 +32,19 @@ :documentation "Have we already prepared this command object") )) +(defmethod initialize-instance :after ((o command-object) &key &allow-other-keys ) + ;; Inits parameter nulls + (setf (parameters o) (parameters o))) + +(defmethod (setf parameters) (new (o command-object)) + " This causes the semantics to match cl-sql instead of cl-postgresql + " + (setf (slot-value o 'parameters) + (loop for p in (parameters o) + collect (cond ((null p) :null) + ((member p (list :false :F)) nil) + (T p))))) + (defun reset-command-object (co) "Resets the command object to have no name and to be unprepared (This is useful if you want to run a command against a second database)" -- 2.34.1