Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: DB

Can't get multiple to work in dtml-sqltest

 

 

Zope db RSS feed   Index | Next | Previous | View Threaded


mark at phillipsmarketing

Oct 1, 2010, 6:32 PM

Post #1 of 2 (1442 views)
Permalink
Can't get multiple to work in dtml-sqltest

I have a ZSQL query getPlayersBySeasons with one input value, seasonID:

select distinct player.playerID, firstName, lastName, number, birthdate,
positions, bats, throws, active
from player, SeasonPlayer
<dtml-sqlgroup required where>
<dtml-sqltest seasonID column=SeasonPlayer.seasonID type=int optional
multiple>
<dtml-and>
SeasonPlayer.playerID=player.playerID
</dtml-sqlgroup>

and my python code:
players = context.getPlayersBySeasons(seasonID=s).dictionaries()

If s = [1], or s=[2], or s=[1,2] or s="", I get the same result set back.

What is the correct syntax for using the multiple key word? I have googled
and it seems that a lot of people have problems, and no one has a solution.

Thanks!

Mark


mark at phillipsmarketing

Oct 2, 2010, 8:46 AM

Post #2 of 2 (1367 views)
Permalink
Re: Can't get multiple to work in dtml-sqltest [In reply to]

Never mind.....cockpit error.....I looked a the sql generated from the
queries and it was correct in all cases. The problem lay elsewhere in my
Python script. Multiple works as advertised!

BTW, I also read in some posts that the type parameter does not work. But
according to my mysql logs, the type parameter does work as advertised. The
only issue is one cannot enter a list of values from the ZMI to test the
sql. You have to do it from a Python script.

Mark

On Fri, Oct 1, 2010 at 6:32 PM, Mark Phillips <mark [at] phillipsmarketing>wrote:

> I have a ZSQL query getPlayersBySeasons with one input value, seasonID:
>
> select distinct player.playerID, firstName, lastName, number, birthdate,
> positions, bats, throws, active
> from player, SeasonPlayer
> <dtml-sqlgroup required where>
> <dtml-sqltest seasonID column=SeasonPlayer.seasonID type=int optional
> multiple>
> <dtml-and>
> SeasonPlayer.playerID=player.playerID
> </dtml-sqlgroup>
>
> and my python code:
> players = context.getPlayersBySeasons(seasonID=s).dictionaries()
>
> If s = [1], or s=[2], or s=[1,2] or s="", I get the same result set back.
>
> What is the correct syntax for using the multiple key word? I have googled
> and it seems that a lot of people have problems, and no one has a solution.
>
> Thanks!
>
> Mark
>

Zope db RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.