[Zope] general queries
Marco Guidi
GUIDI@sssup.it
Tue, 20 Jul 1999 14:20:52 +0200
With the help of some friends we were able to generalize a little
our queries (e.g. the following update, where parameter_field_name and
parameter_field_value are setted by the caller of the query. This
caller is called by the form action).
Now we've any problems more to make the queries more general.
1. We would like to set a "dictionary" inside the REQUEST so that we
can use an <!--#in REQUEST.our_dictionary.keys()--> iterator
just after the where keyword. Is there anyone who knows how to do it
(if possible) ?
2. Depending on how the user fills the form, the where clause may
require some different operators (>, <, and or, and so on). is there
a way to generalize this (may be the creation of a dictionary
in the REQUEST with the where operators needed by the specific form ?).
Thank you in advance.
Marco Guidi,
Pinella Valvo.
update <!--#var "REQUEST.form['tab']"-->
set
<!--#in "REQUEST.form.keys()"-->
<!--#call "REQUEST.set('nome_campo',_['sequence-item'])"-->
<!--#if sequence-start-->
<!--#in ShowFields-->
<!--#if "REQUEST.has_key(_['sequence-key'])"-->
<!--#if "_['sequence-key']==REQUEST['nome_campo']"-->
<!--#if "_.string.find(_['Type'],'char') <> -1"-->
<!--#var "_['sequence-key']"-->=<!--#sqlvar
"REQUEST[_['sequence-key']]" type=string-->
<!--#elif "_.string.find(_['Type'],'int') <> -1"-->
<!--#var "_['sequence-key']"-->=<!--#sqlvar
"REQUEST[_['sequence-key']]" type=int-->
<!--#elif "_.string.find(_['Type'],'float') <> -1"-->
<!--#var "_['sequence-key']"-->=<!--#sqlvar
"REQUEST[_['sequence-key']]" type=float-->
<!--#/if-->
<!--#/if-->
<!--#/if-->
<!--#/in-->
<!--#else-->
<!--#in ShowFields-->
<!--#if "REQUEST.has_key(_['sequence-key'])"-->
<!--#if "_['sequence-key']==REQUEST['nome_campo']"-->
<!--#if "_.string.find(_['Type'],'char') <> -1" -->
,<!--#var "_['sequence-key']"-->=<!--#sqlvar
"REQUEST[_['sequence-key']]" type=string-->
<!--#elif "_.string.find(_['Type'],'int') <> -1"-->
,<!--#var "_['sequence-key']"-->=<!--#sqlvar
"REQUEST[_['sequence-key']]" type=int-->
<!--#elif "_.string.find(_['Type'],'float') <> -1"-->
,<!--#var "_['sequence-key']"-->=<!--#sqlvar
"REQUEST[_['sequence-key']]" type=float-->
<!--#/if-->
<!--#/if-->
<!--#/if-->
<!--#/in-->
<!--#/if-->
<!--#/in-->
where <!--#var "REQUEST['parametro_nome_campo']"-->=<!--#sqlvar
"REQUEST['valore_campo']" type=string-->