Hi everybody,<br><br>(elephant:defpclass messout ()<br> ((message :accessor messout-message<br> :initarg :message<br> :initform nil<br> :index t)<br> (creation-date :accessor messout-creation-date<br>
:initarg :creation-date<br> :initform nil<br> :index t)<br> (sent :accessor messout-sent<br> :initarg :sent<br> :initform "false"<br> :index t))<br> (:index t))<br><br>
(defun queue-messout (message)<br> "Add a message in the sending queue."<br> (format t "Queue message for sercen: ~a~&" message)<br> (make-instance 'messout :message message :creation-date (local-time:local-time) :sent "false"))<br>
<br>(defun send-sercen-messout ()<br> "Send a consecutive serie of messages to sercen"<br> (elephant:ensure-transaction ()<br> (let* ((messages (elephant:get-instances-by-value 'messout 'sent "false"))<br>
(sorted-message (sort messages #'local-time:local-time< :key 'messout-creation-date)))<br> (dolist (messout sorted-message)<br> (format t "Send message to sercen: ~a~&" (messout-message messout))<br>
(setf (messout-sent messout) "true")))))<br><br><br>Using this class definition over a fresh bdb base with unstable, and executing the following shows the normal behaviour.<br>(queue-messout "USERORG|1111|2802")<br>
(queue-messout "USERORG|2222|2802")<br>(queue-messout "USERORG|3333|2802")<br>(queue-messout "USERORG|4444|2802")<br>(elephant:get-instances-by-value 'messout 'sent "false")<br>
-> (#<MESSOUT oid:11> #<MESSOUT oid:12> #<MESSOUT oid:13> #<MESSOUT oid:14>)<br>(elephant:get-instances-by-value 'messout 'sent "true")<br>-> NIL<br>(send-sercen-messout)<br>
-> NIL<br>(elephant:get-instances-by-value 'messout 'sent "false")<br>-> NIL<br>(elephant:get-instances-by-value 'messout 'sent "true")<br>-> (#<MESSOUT oid:11> #<MESSOUT oid:12> #<MESSOUT oid:13> #<MESSOUT oid:14>)<br>
<br><br>But if you replace "true" and "false" by t and nil, the two last get-instances-by-value return exactly the same result (the whole 4 objects).<br>(elephant:get-instances-by-value 'messout 'sent nil)<br>
(#<MESSOUT oid:4> #<MESSOUT oid:8> #<MESSOUT oid:9> #<MESSOUT oid:10>)<br>(elephant:get-instances-by-value 'messout 'sent t)<br>(#<MESSOUT oid:4> #<MESSOUT oid:8> #<MESSOUT oid:9> #<MESSOUT oid:10>)<br>
<br>Hope this is descriptive enough.<br>