[elephant-devel] Mixing "logical" layers in an elephant application

Alex Mizrahi killerstorm at newmail.ru
Sun Dec 9 16:25:43 UTC 2007


      AP>  When I tried the above, it blew up when I added the 
ENSURE-TRANSACTION
      clause; because all of a sudden the DOQUERY found itself querying
      on the "wrong" database.  (I'm assuming ENSURE-TRANSACTION binds
      something like a *DATABASE* var which got mistakenly inherited by
      the postmodern layer)


so you have two postmodern connections?

there are two layers in POSTMODERN: postmodern itself uses special variable
*database* to control which connection is used, but in lower level
cl-postgres connection is passed explicitly.
elephant's backend uses both. it uses with-postmodern-conn macro when it's
going to use it's own database. other times it uses cl-postgres layer and
that shouldn't affect other uses (it uses it's own special variable
*connection* and passes it to cl-postgres calls).

it calls with-postmodern-conn in ensure-transaction (i'm not sure why it's
there, but it is).
 so you need to fight-back your connection in your map-visits (or before you
call it, but inside elephant's ensure-transaction). even if you call
elephant functions from it, it should automatically switching connections
and it should "just work".
if it doesn't, it's a bug, and with-postmodern-conn macro should be inserted
somewhere.

alternatively you can use cl-postgres, or make your own macros that both
allow fancy syntax and explicit connection specification..

i think that besides connection nothing can be messed with postmodern -- if
you do two connections they are totally independent.
but i'm afraid you're first human on the earth who uses both
elephant/db-postmodern and postmodern combination simultaneously, so nobody
really knows.. :)

(seems like gmane have ate my post, re-sending it directly. apologies if it 
will be duplicated) 




More information about the elephant-devel mailing list