Another possible problem is that many of the Elephant operators (get-
instances-by-name) are independent of Weblocks and rely on a common
global variable, *store-controller*. To make things more fun,
weblocks also uses a default store reference *default-store* The
first store opened becomes *store-controller* and any subsequent
operations go there. If you want to have multiple controllers for
multiple applications, you have to be explicit about using your
weblocks store for the weblocks API functions, and the Elephant store
if you are using Elephant's native functions.
However, after you wrap up store accesses in webapp specific
functions, then you shouldn't have to think about this much. This
macro might be helpful.
(defmacro with-ele-store ((wl-store) &body body)
`(let ((*default-store* wl-store)
(*store-controller* (elephant-controller ,wl-store)))
(declare (special *store-controller* *default-store*))
,@body))
(defun get-person (name)
(with-ele-store (*webapp-store1*)
(get-instance-by-value 'person 'name name)))
Ian
On Mar 19, 2009, at 8:53 AM, Andrea Russo wrote:
>
> Hi,
>
> I'm trying to write my first web application using weblocks slowly
> trying to break the ice with this magical framework.
>
> I'm really a common lisp newbie, so sorry if my questions are too lame
> :-)
>
> Trying to learn from the examples, I'm often bitten from strange
> problems regarding the persistence layer.
>
> In particular, I loaded the simple-blog demo, the weblocks-elephant-
> demo
> and an home made webapp which uses also the elephant persistence
> layer.
>
> When I run these webapps isolated, all works like a charm, but when
> starting them together it seems that they end up using the same
> persistence store, instead of using the stores defined in their own
> package.
>
> I'm using weblocks-stable with sbcl 1.0.26.1 from clbuild with cffi
> and
> uffi installed through asdf-install to make the elephant layer works.
>
> So, my question is: how can I use multiple elephant storage in my
> weblocks applications?
>
> Any help would be much appreciated.
>
> TIA,
> Andrea.
>
> --
> Reclama i tuoi diritti digitali, elimina il DRM. Approfondisci su
> http://www.no1984.org
> Reclaim your digital rights, eliminate DRM. Learn more at
> http://www.defectivebydesign.org/what_is_drm
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"weblocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/weblocks?hl=en
-~----------~----~----~----~------~----~------~--~---