From: Russ Tyndall Date: Mon, 18 Jan 2010 16:21:48 +0000 (-0500) Subject: command-objects: made nil be treated as "null" in the database by default instead... X-Git-Url: http://git.kpe.io/?a=commitdiff_plain;ds=sidebyside;h=051f4d2f472406fa381e20d2da0cf25f091f262a;hp=a5eb71537ba68b002a54752f484b23306aa0761f;p=clsql.git command-objects: made nil be treated as "null" in the database by default instead of "false". To pass false use :false or :f --- 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)"