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. Doing it using an external method, I will loose the niceties of dtml-sqlvar such as auto escaping of input and such. Suggestions anyone ? __________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail
Am Sonntag, den 06.02.2005, 07:30 -0800 schrieb Low Kian Seong:
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.
Doing it using an external method, I will loose the niceties of dtml-sqlvar such as auto escaping of input and such.
You can loop over a list of arguments and build your query with that. If you use all <dtml-sqlvar type=string> it whould work for postgres. However, I wonder how you created your tables and your formular code without manually writing the 26 field names anyway... And lets hope your users like to write so many fields too ;) (Hint: you can also create the code inside the ZSQL Method with a script as code generator - just look up the arguments in ZMI when you create a ZSQL method manually) Regards Tino
participants (2)
-
Low Kian Seong -
Tino Wildenhain