On 8/28/07, Rafał Strzaliński nablaone@gmail.com wrote:
Is there any way to separate DAO definition and db connection spec? Keeping connection spec in one place (global variable) makes deployment easier.
Well, the idea behind each class having its own connection spec is that I would like to allow each class to be connecting another database. I don't know if this is the best approach (after all, this is not the most common a situation), and maybe I will rethink it.
Personally, I usually wrap my dao defnitions into a macro with the right connection spec, like the following:
(defmacro defdao-example (name supers &body body) "Wrapper macro for defining a class inheriting from DAO with the metaclass set to HTML and the right connection-spec." `(defdao ,name ,supers ,@body (:connection-spec "submarine-test" "richard" "dupa" "localhost")))
BTW, nice password ;-)
Well, I guess it is one of the glorious Polish traditions (-;
Bests,
-- Richard