[Zope] variable SQL insert method

Allen Wallis allen@rrsg.ee.uct.ac.za
Thu, 30 Mar 2000 13:12:10 +0200


Hi,
I have a database with 3 tables. I would like to create a ZSQL method
for inserting data into the tables. I started by creating a separate
method for each table, but that seems a bit of a waste. Ideally I would
like to have one method, "addEntry". The template would look something
like:

<dtml-if "tname=='supplier'">
INSERT INTO <dtml-var tname> VALUES (NULL, <dtml-sqlvar sup_name
type=string>  etc...);
<dtml-elif "tname='manufacturer'">
INSERT INTO <dtml-var tname> VALUES (NULL, <dtml-sqlvar man_name
type=string> etc...);

</dtml-if>

The problem is that I have to specify the arguments in the argument
list, and the arguments are different for each if clause in the above
code. Is there a way around this?

thanks
Allen