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

Randall Kern randy@teamkern.net
Tue, 5 Dec 2000 11:57:48 -0800


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 )
>