[Zope] INSERT/UPDATE in SQL methods

Joachim Schmitz perry@ac-copy.net
Tue, 17 Aug 1999 13:29:08 +0200 (CEST)


On Mon, 16 Aug 1999, Evan Simpson wrote:

[lot of useful things snipped]

> Most often, you will want the values for your parameters to come from request
> data (a submitted form, environment variables, etc.)  In this case you *must*
> include them in the ZSQL Method's parameter list.  If your parameter list is
> "name email", and REQUEST contains "name" and "email" values, then you can do the
> following:

I want to write a general ZSQL method like this:
 
insert into <!--#var table sql_quote upper --> (
<!--#in EinAusgabe -->
<!--#unless sequence-start -->,<!--#/unless -->
<!--#var name -->
<!--#/in -->)
values
<!--#in EinAusgabe -->
<!--#unless sequence-start -->,<!--#/unless -->
<!--#var expr="_[name]" fmt=sql-quote-->"
<!--#/in -->)

Where EinAusgabe is a TinyTable describing the field for the form like
this:
columns:
name label ftype length:int default auto
data:
"event_id", "Event-Nr", "int", 10, "", "max"
"art", "Event-Art", "string", 20, "kino", NULL
"veran_id", "Veranstalter-ID", "string", 8, NULL, NULL
"veran_ort", "Ort", "string", 40, NULL, NULL
"veran_title", "Titel", "string", 80, NULL, NULL
"veran_link", "Link", "string", 40, "http://", NULL
"datum_von", "von", "date", 10, NULL, NULL
"datum_bis", "bis", "date", 10, NULL, NULL
"zeiten", "Zeiten", "string", 60, NULL, NULL

and nothing in the parameter list. This actually works, except, that I
have to name the arguments in the list. How can I avoid that ? Can I use
dtml-tags in the argument list ?

Gruß

Joachim Schmitz

WWW-Consultant

email: js@ac-copy.net
tel: +49-241-89491-0
fax: +49-241-89491-29