[Zope] A question about ZSQL

Andreas Jung lists at andreas-jung.com
Sun Feb 6 10:39:44 EST 2005



--On Sonntag, 6. Februar 2005 7:25 Uhr -0800 Low Kian Seong 
<zope_low at yahoo.com> wrote:

> Dear people,
>
> I have a survey form that has about 26 fields in them
> and I want to put the data into a postgresql database
> via a psycopg adapter. Problem is when i build the
> insert using a zsql, do i have to manually create each
> field using <dtml-sqlvar ? seems very long and
> unproductive way to do it.

I am not completely sure but I assume that you can specify
**kw  as argument of a ZSQL method. So you could loop over
the key-value pairs *but* you have to deal on your own *somehow* with
different types (int,string, date etc.) (keep in mind that <dtml-sqlvar
expects the name of an argument and its type). Depending on the database
you could specify everything as 'string' but let the database to the 
conversion
e.g. to 'int'. But at the point when you're dealing with dates or other 
types this
approach will slap you into your face.

-aj



More information about the Zope mailing list