[Zope] How to specify to z sql methods, the connection object to use at runtime...time...

Frederic Quin frederic.quin@free.fr
Wed, 06 Dec 2000 10:46:29 +0100


Thanks to yall...
Finally, I thought like you Randy... I created as many folders as many
servers I have. Each folder contains a connection object called "con"
every where. Each folder contains also Z SQL Methods. Some of them
contains the same Z SQL Methods. So, I just have to specify the server I
want to connect to and use directly the Z SQL Method I want.

My folders (called like my servers) are Transparent Folder. So, I can
call directly some Z SQL Methods which are available only on one
server...


Fred



Randall Kern wrote:
> 
> I haven't actually tried this, but it seems it should work:
> 
> /
>     /db1    - folder
>         connection    - a DB connection object to db 1
>     /db2    - folder
>         connection    - a DB connection object to db 2
>     query    - a ZSqlMethod, set to use the connection 'connection'.  Note,
> you may have to add a temporary DB connection to the root, to allow you to
> setup these methods.  After you have created your methods, remove the
> /connection object.
> 
> Then use urls like http://your.server/db1/query to run the query using the
> first database connection, and http://your.server/db2/query to run query
> using the second database connection.
> 
> -Randy
> ----- Original Message -----
> From: "Tino Wildenhain" <tino@wildenhain.de>
> To: "Frederic Quin" <frederic.quin@free.fr>
> Cc: <zope@zope.org>
> Sent: Tuesday, December 05, 2000 4:56 AM
> Subject: Re: [Zope] How to specify to z sql methods, the connection object
> to use at runtime...time...
> 
> > Hi Frederic,
> >
> > Frederic Quin schrieb:
> > >
> > > Hi all,
> > >
> > > I have the same querry to execute on different servers. I don't want to
> > > create as many z sql methods as servers I have. I would like to specify
> > > to my z sql method, the connection object to use at run time. Do I have
> > > to patch the files of z sql methods ? Can I use directly the connection
> > > object ??
> > A clean approach would be subclassing the zsql-method
> > for your purpose. I would not recommend a free-form
> > string as argument for the Datasource. May be an integer index
> > (first, second, third... database server)
> > or something like that?
> >
> > Regards
> > Tino
> >
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
> >