[elephant-devel] unable to use persistent-class

Robert L. Read read at robertlread.net
Wed Jan 25 22:20:35 UTC 2006


On Wed, 2006-01-25 at 22:58 +0200, Aycan iRiCAN wrote:

> Thank you,
> 
> I opened the store before my class declaration. Could this be changed
> in the future? Why we need to open the store first?


Off the top of my head, it would not be easy to change it.  The store
must be opened for 
something to be persisted into it; defining the class as a minimum sets
up some identifiers
in preparation for the first instance being created.


> 
> Now I have another problem. I have a web action that handles a form
> post. This action creates an instace of content class and fills the
> data slot.
> 
> Since I am using utf-8 encoding with sbcl, when I list the content
> instances with a web page, I'm having strange characters from data
> slot.
> 
> Is there any problem with utf-8? I didn't tried to persist the
> instance yet. Just created an instance and read back from it.


I use SBCL 0.9.5 with the unicode option turned off and I persist
unicode strings there often
and have not had a problem.  I have no reason to believe there is a bug,
but of course there
might be.

That question can really only be answered by a small test example.  In
my experience, 
there will be at least as many problems encountered in the rendering of
the characters 
and the character encoding as the actual storage.  If you can reduce the
problem to 
a very small test program, we can construct a test from that a debug it.

I have in fact only stored characters which happen to be from the
Esperanto 
character set, which is ISO-8859-3, but it it is using the utf-8
encoding.

I specifically had to make some changes to make sure it works with SBCL
when 
the unicode feature is turned on.

If things look wonky, you might try converting to bytes and looking at
the actual 
byte values.


> 
> Best Regards.
> 
> "Robert L. Read" <read at robertlread.net> writes:
> 
> > You will also have to depend on :ele-bdb.
> >
> > Yes, it looks to me like it is the same problem as Waldo's that you mention;
> > you have to call:
> >
> > (open-store "pathtotheBerkeleyDBdatabasedirectory")
> >
> > before you invoke defclass.
> >
> > I would try executing that, and then your class definition,
> > directly in a  REPL or listener by hand.
> >
> > If that works, you might have to do the open-store inside an "eval-when" clause,
> > depending on how you have organized your code.
> >
> > Does that make sense?
> >
> > On Wed, 2006-01-25 at 20:45 +0200, Aycan iRiCAN wrote:
> >
> >     Hello,
> >
> >     I'm trying to use elephant in one of our projects. It's a simple UCW
> >     based web application. I set up elephant properly and run
> >     tests. Started sbcl with slime and evaluate a few lines
> >
> >     (asdf:oos 'asdf:load-op :elephant)
> >     (asdf:oos 'asdf:load-op :ele-bdb)
> >     (asdf:oos 'asdf:load-op :elephant-tests)
> >     (do-all-tests-spec *testdb-path*)
> >
> >     The result is:
> >
> >     5 out of 106 total tests failed: BASICPERSISTENCE, MIGRATE1, MIGRATE2,
> >        MIGRATE3, MIGRATE4.
> >
> >     After these results, I think that I can try to use it with my
> >     application. I just added :elephant to dependencies of my system
> >     definition. 
> >
> >     <snip>
> >        :depends-on (:ucw :elephant)
> >     </snip>
> >
> >     And also added it to my package definition.
> >
> >     <snip>
> >         (:use :common-lisp :it.bese.ucw :elephant)
> >     </snip>
> >
> >     I have a simple content class. So I defined its metaclass.
> >
> >     (defclass content ()
> >         ((title :accessor title
> >                 :initarg :title
> >                 :initform "Sample Title"
> >                 :documentation "Title for content")
> >          (data :accessor data
> >                :initarg :data
> >                :initform "Data"
> >                :documentation "Data for content"))
> >       (:metaclass persistent-metaclass))
> >
> >     After these steps, I tried to load my app with asdf but got this
> >     error:
> >
> >     debugger invoked on a SIMPLE-ERROR in thread
> >     #<THREAD "initial thread" {90033C9}>:
> >       Error during processing of --eval option (LOAD #P"bin/make-image.lisp"):
> >
> >       There is no applicable method for the generic function
> >         #<STANDARD-GENERIC-FUNCTION ELEPHANT::NEXT-OID (1)>
> >       when called with arguments
> >         (NIL).
> >
> >     Is this problem related with Waldo Rubinstein's post? 
> >         http://common-lisp.net/pipermail/elephant-devel/2006-January/000212.html
> >
> >     Can you give me a temporary solution?
> >
> >     Best Regards.
> >
> >     _______________________________________________
> >     elephant-devel site list
> >     elephant-devel at common-lisp.net
> >     http://common-lisp.net/mailman/listinfo/elephant-devel
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20060125/caa36cda/attachment.html>


More information about the elephant-devel mailing list