[Cl-perec-devel] Lots of questions :-)

Attila Lendvai attila.lendvai at gmail.com
Thu Sep 17 08:49:41 UTC 2009


>> (setf authenticated-session (load-instance authenticated-session
>> :skip-existence-check #t :copy-cached-slot-values #t))
>
> I couldn't get this to work -- I still can't access that object outside
> a transaction.  But I'm leaving this for now.


that statement clones a dead instance into the current transaction.

silently allowing the access of instances outside a transaction can
lead to many headaches, not to mention cross transaction access, so
it's an error by default. changing this behavior would be trivial, but
i advise you to change your requirements instead... :)


> 1. I have a N-M relationship between Users and Groups.  For this, perec
>   creates an intermediate table, which is great because I don't have to
>   do it myself :-) but not so great because I don't know how I can
>   control it.


if you need full control like slots, then create the intermediate
entity by hand with two associations to the two sides. that's a design
decision in cl-perec, and i think a good one.


>   When I do (push new-group (grups-of user)) perec deletes all groups
>   of that user from the intermediate table, then re-inserts them, which
>   makes sense because one can change the whole set of groups at once,
>   but in the particular case of adding a new group seems overkill.  I
>   was wondering if there is a way to add a single instance.


push setf's the place, and there's no optimization for that yet.

but you can use the cl-containers api functions, like insert-item (or
sg like that) using the foo-of* accessors which return a cl-containers
container.

not sure whether the actual optimization is done or not.

-- 
 attila




More information about the cl-perec-devel mailing list