[Zope] ZSQL statement pass variables.

Chris Kratz chris.kratz at vistashare.com
Wed Jan 14 10:56:16 EST 2004


Hello rob,

Use <dtml-var my_column_headings> inside of your zsql statement.  Dtml 
statements are valid in a zsql statement.

For safety if the column headings are user specified, you will want to import 
sql_quote in a python method and call it on each column heading independently 
before placing them in a list or string because you are bypassing the safety 
of sql-var.

Good luck,

-Chris

On Wednesday 14 January 2004 10:45 am, RI Dunfey wrote:
> Hi Everyone,
>
> I want to run a zsql select statement from a python script.  I want to
> specify the column headings to include in the SQL statement in the python
> script before executing the script.  I have tried using <dtml-sqlvar
> my_column_headings type="string"> but this puts quotes around them.
>
>
> ZSQL:
>
> select <my_column_headings> from applicant
>
> In my python I want to specify the headings as a variable, eg.
>
> my_column_headings = title, surname
>
> The variable is passed to the ZSQL and executed as:
>
> select title, surname from applicant.
>
>
> Do you see what I mean, is thgis possible?  If so could someone point me in
> the right direction.
>
> Kind Regards,
>
> Rob
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )

-- 
Chris Kratz
Systems Analyst/Programmer
VistaShare LLC
www.vistashare.com




More information about the Zope mailing list