[Zope] Best way to handle SQL update with variable number of fields?

Farrell, Troy troy.farrell@wilcom.com
Sun, 10 Sep 2000 11:25:47 -0500


I'm trying to understand exactly what you mean.  I have some ZSQL Methods
that have an empty (INSERT INTO site_location VALUE('New York', '')) value
in them.  For the above I use: INSERT INTO site_location VALUE(<dtml-sqlvar
site_city type=string>, <dtml-sqlvar site_zipcode type=int>).  Can you
provided your ZSQL Methods so we can understand better?

Troy Farrell

-----Original Message-----
From: chris@ncafe.com
To: zope@zope.org
Sent: 9/10/00 4:33 AM
Subject: [Zope] Best way to handle SQL update with variable number of
fields?

Hello,

I'm creating a number of ZSQL methods to insert, update and delete 
records from several Oracle tables. Everything is working fine with 
the insert forms (creating new records) and the delete (of course). 
However, the best way to do the  * update * without locking the user 
into a *very* rigid format is eluding me..

The problem - I would like to populate the form with the existing 
values and then allow the user to change the ones they want to. Some 
of the fields in the database are empty and it will always be that 
way. The length of the update statement will change.

  Nomatter how I do it, I am having problems with the commas.  What is 
the best way to build the necessary logic into the form? Is there a 
sample in a product or a How-to somewhere that I can look at?

I am assuming I need to create a list externally in a method and use 
that to determine the comma placement. Is that the "correct" 
direction? Or is there a better way..



Thank you,

Chris Beaumont
cbeaumon@msri.org