Threading and CLSQL

"[email protected]" <[email protected]> Mon, 14 Oct 2013 14:37:25 +0300
Newsgroups gmane.lisp.clsql.general
Message-ID <CAO3GLT89dGh_m2xCJ-yfgoRg9fFNYPDc7_CCqyaAFEDDjVeXMQ@mail.gmail.com>
Hey Everyone,

So I have been doing some heavy work with CLSQL and I think I have stumbled
upon several points that make me thing that clsql is not actually thread
safe due to the *default-database* variable. I would really appreciate if
someone could shed some light on this and correct me if I am wrong.

Specifically consider the following case where any and all database
function calls are wrapped inside a "with-database" you will find that if
the with-database sets the default database then making several requests at
the same time you will get some errors such as database is nil (I did my
tests using Hunchentoot with threading and sent simultaneous ajax
requests). The situation actually gets much worse if you try to specify the
database when using clsql (ie setting the key database argument to
functions). Since then creating an instance which has an auto-increment and
trying to save that instance raises the error that default database is not
set. Also if a clsql view has a join that is deferred then it will not be
possible to update it.

I believe i have several solutions to the above problem (they are
implemented and working in code) and I am considering writing a blog post
about how to overcome this. But I wanted to check with the list first
before I go writing a post that makes claims that are not accurate about
clsql (which I would never want to do because nothing but respect is owed
to the programmers and maintainers of this library)

Regards,

Mackram

_______________________________________________
CLSQL mailing list
[email protected]
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql