[Zope] variable SQL statements - from external methods

Thomas B. Passin tpassin@mitretek.org
Tue, 18 Sep 2001 18:01:51 -0400


[ed colmar]
>
>     Jim and several others were helping me to get my variable SQL methods
> working right.  They're great and do everything I want form the test
window.
> When I call them from my external method, they come back with a REQUEST
> error.
>
> This is how I call it:
>
> mastertablename = "sometablename"
> self.SQL_create_master_table(mastertablename=mastertablename)
>
> Then I get:
>
> Error Type: Bad Request
> Error Value: ['mastertablename']
>
> Whats the syntax to shove this variable and it's value inside the request?
> Or am I doing something else wrong?

I suggest that you don't call your SQL methods from an external method at
all.  Instead, get the data you need for the second SQL query right from the
first query (going to an external method if you need to massage it heavily)
in your DTML page,  execute the second query from the page, then feed that
data to an external method if you need to do manipulation on the data.

Let each part of the system do what it's good at.  The ZSQL method is good
at being called from DTML and getting data from a database, and the external
method is good at processing  data.  Send it the data, don't make it run a
ZSQL method.  I'm not saying you can't - just that it's better this way.

Cheers,

Tom