[Zope-dev] multiple database connections

Jerome Alet alet@unice.fr
Thu, 7 Mar 2002 11:34:21 +0100 (MET)


Hi,

First I have to say I've not tried what is discussed below, I'm just
thinking about how this could be done...

Say I have several relationnal databases, both have an identical
structure.

Since these databases are identical, all my ZSQL methods can be used with
any of them.

So I plan to architecture my Folder tree like that :

	Level0
	|
	+-- ZSQLMethod1
	+-- ZSQLMethod2
	+-- ...
	+-- Level1-1
	|   |
        |   +-- DAConnection
	|   +-- ... some stuf specific to this database ...
	|
	+-- Level1-2
	    |
            +-- DAConnection
	    +-- ... some stuff specific to this database ...

Each DAConnection connects to a different database, but the id is
identical in order for the ZSQL methods to find it in whichever folder
they are called.

Now the problem is : one can't create a ZSQL method if there's no
DAConnection at the same level or above.

I suppose that creating all my ZSQL methods in for example Level1-1, then
cutting&pasting them in Level0 could work, but I find this very counter
intuitive. And if this would work, then the ZSQL methods wouldn't be
editable anymore since at Level0 there's no DA... 

So my question is : why the hell can't developpers create ZSQL methods as
they see fit, and be allowed to type-in the name of a possibly
not-yet-existing Database Connection ? After all, creating ZSQL methods
isn't for end users, so maybe Zope could trust developpers in knowing
exactly what they want to do...

Adding a free text field and allowing a "Free" entry in the drop-down list
in the ZSQL method creation form would help. The Test tab form could also
be modified to allow the developper to choose any DA at test time. 

Any comment or a solution to do this the right way ?

thanks in advance.

Jerome Alet - alet@unice.fr - http://cortex.unice.fr/~jerome
Fac de Medecine de Nice        http://wwwmed.unice.fr 
Tel: (+33) 4 93 37 76 30     Fax: (+33) 4 93 53 15 15
28 Avenue de Valombrose - 06107 NICE Cedex 2 - FRANCE