Re: [Zope-DB] Problem with dtml-sqltest ... multiple feature

2008-02-14 Thread Jaroslav Lukesh

Try to set url_name as ['HI','RF'] and use property without datatype, like

params
url_name
...
/params

And of course, look at ZopeBook.

Personally I dont use sqltest nor sqlgroup because there are many caveats 
with queries to cooperate with other zope unfriendly SQL developers. I use 
dtml-in inside ZSQL method with parameters defined as above.


- Original Message - 
From: Ken Winter [EMAIL PROTECTED]


select
   organization_id, name, url_name, short_name
from
   organization
dtml-sqlgroup where
   dtml-and dtml-sqltest organization_id op=eq type=int multiple
optional
   dtml-and dtml-sqltest url_name op=eq type=nb multiple optional
   dtml-and dtml-sqltest name op=eq type=nb multiple optional
/dtml-sqlgroup

doesn't work properly when I give it a sequence of values to test the
condition against, which is what the multiple tag is supposed to allow
according to http://www.plope.com/Books/2_7Edition/AppendixA.stx#1-15 .
When I enter (for example) the string HI, RF (without the surrounding
quotes) into the url_name field on the ZSQL method's ZMI Test tab, it
returns no records and says that the SQL it generated was:

select
   organization_id, name, url_name, short_name
from
   organization
where
url_name = 'HI, RF'

If I enter a series of integers such as 11530, 11531 (again, minus the s)
into the organization_id field, it returns the error message:

Invalid integer value for organization_id

Entering a single value into any of these fields works fine.  I have tried
various ways of quoting, delimiting, and otherwise punctuating my
multiple-value arguments, to no avail.

Is this problem just because the multiple feature doesn't work when tested
in the ZMI?  If so, can you tell me the correct way to type and format the
multiple-valued arguments when calling the ZSQL method from Python or from a
Page Template?

b 


___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Problem with dtml-sqltest ... multiple feature

2008-02-14 Thread David Daniel Estévez Durey

Hello Ken,

I have been a long time looking for the way to type in an array a 
values in the Test tab forms of the ZMI,

but I think that it isn't possible.
In the documentation I read that it is recommended to specify the type 
of the arguments in the ZSQL method

as in the following example:

---
Parameter list: organization_id:list:integer url_name:list:string 
name:list:string



select
organization_id, name, url_name, short_name
from
organization
dtml-sqlgroup where
dtml-and dtml-sqltest organization_id op=eq type=int 
multiple

optional
dtml-and dtml-sqltest url_name op=eq type=nb multiple 
optional

dtml-and dtml-sqltest name op=eq type=nb multiple optional
/dtml-sqlgroup

---

However, I have tested that specifying the type of the arguments makes 
no difference!


On the other hand, the SQL Method works fine when is called from a 
Script Python or a ZTP

as in the following example:
---
context.zsql_method({'organization_id':[1,2,3], url_name:['a','b'], 
name:['z']}).dictionaries()

---

I don't know if I have helped you. Good luck!




El 14/02/2008, a las 2:00, Ken Winter escribió:


This ZSQL method:

select
organization_id, name, url_name, short_name
from
organization
dtml-sqlgroup where
dtml-and dtml-sqltest organization_id op=eq type=int 
multiple

optional
dtml-and dtml-sqltest url_name op=eq type=nb multiple 
optional

dtml-and dtml-sqltest name op=eq type=nb multiple optional
/dtml-sqlgroup

doesn't work properly when I give it a sequence of values to test the
condition against, which is what the multiple tag is supposed to 
allow

according to http://www.plope.com/Books/2_7Edition/AppendixA.stx#1-15 .
When I enter (for example) the string HI, RF (without the surrounding
quotes) into the url_name field on the ZSQL method's ZMI Test tab, it
returns no records and says that the SQL it generated was:

select
organization_id, name, url_name, short_name
from
organization
where
url_name = 'HI, RF'

If I enter a series of integers such as 11530, 11531 (again, minus 
the s)

into the organization_id field, it returns the error message:

Invalid integer value for organization_id

Entering a single value into any of these fields works fine.  I have 
tried

various ways of quoting, delimiting, and otherwise punctuating my
multiple-value arguments, to no avail.

Is this problem just because the multiple feature doesn't work when 
tested
in the ZMI?  If so, can you tell me the correct way to type and format 
the
multiple-valued arguments when calling the ZSQL method from Python or 
from a

Page Template?

~ Ken


___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db