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

Mihai Bazon mihai at bazon.net
Sun Sep 13 10:27:31 UTC 2009


Hi folks,

First off, I think you did a great job!  CL-perec is very cool, but it's
a pity it's poorly documented and it's hard to get started, so I thought
I'd ask my questions on this list...  Please note that I'm new to Lisp
as well, which makes it harder for me to "use the source, Luke".  I'd
love to help with some howtos, once I figure out the stuff I'm after.

Questions, in no particular order:

1. I'm defining my own DB package in which I :USE :CL-PEREC.  This
   introduces some conflicts that can be mitigated by
   :shadowing-import-from :cl-perec :set :time.  What is the recommended
   way, though?  Would it be better if I don't :USE :cl-perec and prefix
   all names with "cl-perec:"?

2. I have a (defpclass* page) which shows the following warning in SBCL:

   ; caught STYLE-WARNING:
   ;   defclass* for CL-PEREC:PAGE while its home package is not *package* (#<PACKAGE "DLWEB.DB">)

   I can guess that there's a class named "page" in cl-perec?

3. OIDs seem to be randomly generated.  Are they generated by cl-perec,
   or by Postgres itself? (I haven't use PG in many years so sorry if
   it's PG-related).

4. I have a Perl background and have used various DB-to-Object mappers
   (and even wrote my own).  Most of them, in Perl, provide an easy way
   to "inflate/deflate" columns.  For example, if a column is of type
   TIMESTAMP (which the DB server returns as a string), when an instance
   is retrieved I can make that slot return an object of type DateTime,
   which is more comfortable to work with.  So in other words, an
   automatic conversion happens when a row is fetched from the DB, and
   the reverse conversion when it's stored into DB.

   Another example is storing hashed passwords in the DB.  In Perl I
   would do:

      $user->password("foobar");
      $user->update;
      ## and now $user->password is some MD5 of "foobar"

   Is there a way to do this with cl-perec?

5. I plan to use cl-perec with hunchentoot for creating sites.  One of
   the things I commonly did in Perl was to use the same code (and
   server) for multiple websites; because they had different data, the
   database connection was selected at runtime, depending on the target
   domain name of the incoming request.  I presume a way to do this in
   cl-perec would be to set the value of *database* accordingly on each
   request, but since Hunchentoot is multithreaded, would this be safe?
   If not, can you recommend a better way?

6. What's with the _ad, _ai, _ap, _dd, _di, _dp views?  I can understand
   some of them, but for example _ad, _ap, _dd and _dp seem to be
   duplicates...

7. How do I define columns of type VARCHAR(255)?  It seems wasteful to
   use TEXT for every string..

I think that's all. :-) Sorry for the long email and thank you for any
clarifications.

Cheers,
-Mihai

http://mihai.bazon.net/blog



More information about the cl-perec-devel mailing list