[Zope-DB] Problem wiith dtml-sqltest variable and multiples values into one parametert ???

CERETTO Thierry t.ceretto at chu-nancy.fr
Wed Nov 29 03:15:00 EST 2006


Hi,

 

(Zope 2.8.6-final, python 2.3.5, win32, ZMySQLDA 2.0.8) 

 

I have created a "Z Search Interface" to select some data from MySql
table.

 

In "search form" (Page Template), I have created a select field (called
"select_keys") to select one or more keys words (from MySQl table). On
submit, with javascript, I fill an hidden field called "ref_fiche" where
I put a list (JS array) of value select in field "select_keys", for
example, value can be : f1 or f1,f4,f2, etc

 

"Search form" use "result_form" which use a "Z SQL Method" where the SQL
is write like this : SELECT titre, descriptif, gestionnaire, coord_gest,
URL  FROM reference_fiche WHERE (<dtml-sqltest ref_Fiche type="string"
multiple>) This Z SQL Method had one parameter called "ref_fiche".

 

Well, from search form, when I select one key word, all works fine: one
result is found and display, but when I select several keys words, SQL
doesn't works, I get this Zope  message :

 

**********************

SQL used:

SELECT titre, descriptif, gestionnaire, coord_gest, URL  FROM
reference_fiche WHERE (ref_Fiche = 'f1, f4')

 

**********************

 

Also, I test with "test" tab of "Z SQL method", it's the same, when I
put "f1" in parameter field, that's work but if I put "f1,f2" (list)
that's doesn't work (I get message above) (alos I tried : "f1","f2" and
'f1','f2', etc, etc, but without success)

 

Zope documentation says about dtml-sqltest variable and multiple
argument;
http://zope.org/Documentation/Books/ZopeBook/2_6Edition/RelationalDataba
ses.stx
<http://zope.org/Documentation/Books/ZopeBook/2_6Edition/RelationalDatab
ases.stx> 

 

**********************

multiple

    A flag indicating whether multiple values may be provided. This lets
you test if a column is in a set of variables. For example when name is
a list of strings "Bob" , "Billy" , <dtml-sqltest name type="string"
multiple> renders to this SQL: name in ("Bob", "Billy").

**********************

 

but, in Zope message above, the SQL used which I see "(ref_Fiche = 'f1,
f4')" and not "ref_Fiche IN ('f1','f4') Why ?

 

It's a bug ?

 

How pass one list parameter ?   

 

Any clues (solutions) are welcome,

 

Thank you,

 

Thierry

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope-db/attachments/20061129/13045f57/attachment.htm


More information about the Zope-DB mailing list