[Zope-DB] ZSQL Method

Matthew T. Kromer matt@zope.com
Mon, 15 Apr 2002 11:37:41 -0400


Rajan Singh wrote:

>I tried creating the following ZSQL Method but it gave
>me an error:
>
>
>select * from <dtml-sqlvar mytable_name type="string">
>

You just want

     select * from <dtml-var mytable_name>

Using dtml-sqlvar is asking for special formatting, e.g.

   <dtml-sqlvar mytable_name type="string">

is converted into the text

    mytable_name = 'valueofmytable_name'

with the appropriate string quoting for the value.

>
>
>The thing i wanted to achieve was to pass the name of
>the table as a parameter and then create an sql
>statement for it.
>
>Could please advise me on how to do it. I am using
>MySQL.
>
>Thank you.
>Rajan
>

-- 
Matt Kromer
Zope Corporation  http://www.zope.com/