[Zope] calling (SQL) methods dynamically from External methods

Philipp Auersperg zope@philosoft.at
Mon, 21 Aug 2000 19:36:30 +0200


Thanks for the answer, it helped me, 
but you missed what I really wanted.

I don't want to call SQL queries by query string, what I want is to
use Z SQL Methods, but I need to identify them by their name as string, because 
in this project we have many complicated queries with parameters.

But finally I am happy because that works:

m1=getattr(self,'dbTest')		#dbTest is a ZSQL method
rs=m1(self)               

for r in rs:
	...........

Thanks

Philipp Auersperg(zwork)

*********** REPLY SEPARATOR  ***********

On 21.08.2000 at 13:32 Andrew Kenneth Milton wrote:

>+-------[ Philipp Auersperg ]----------------------
>| 
>| What I want to do is calling a SQL method given its
>| name as string, so I first have to get the method out of
>| the self.__dict__ and then call it. I need that for calling
>| the SQL methods dynamically for example out of an URL
>| string.
>
>    realConnection=getattr(self,connectionId)
>    realConnection().query(query_in_a_string)
>
>-- 
>Totally Holistic Enterprises Internet|  P:+61 7 3870 0066   | Andrew Milton
>The Internet (Aust) Pty Ltd          |  F:+61 7 3870 4477   | 
>ACN: 082 081 472 ABN: 83 082 081 472 |  M:+61 416 022 411   | Carpe Daemon
>PO Box 837 Indooroopilly QLD 4068    |akm@theinternet.com.au|