[Zope] Troubles with SQL queries

jeffr@odeon.net jeffr@odeon.net
Thu, 23 Mar 2000 13:30:04 -0600 (CST)


Heya folks,

I've got an SQL query that looks like the following:

select artists.hidden_URL,gigs.*
  from artists,gigs
  where artists.name=gigs.name
  and gigs.date >= "<dtml-call "REQUEST.set /
    ('CurrentDate',ZopeTime().Date())">  /
    <dtml-var "REQUEST.CurrentDate">"
  order by gigs.date, gigs.start_time

This works fine.  The '/'s indicate that a single line continues, in the
ZSQL method the 'and gigs.date >= etc." part is on one line.

I'd link to be able to change the values the query is ordered by based on
the link used to access it.  Something like the following:

http://foo.bar.com/Zope/query?first=date&second=start_time

Towards that end I made the above look like:

select artists.hidden_URL,gigs.*
  from artists,gigs
  where artists.name=gigs.name
  and gigs.date >= "<dtml-call "REQUEST.set /
    ('CurrentDate',ZopeTime().Date())">  /
    <dtml-var "REQUEST.CurrentDate">"
  order by gigs.<dtml-sqlvar first type=string>, /
    gigs.<dtml-sqlvar second type=string>

When I test the ZSQL method it shows the SQL used as:

select artists.hidden_URL,gigs.*
  from artists,gigs
  where artists.name=gigs.name
  and gigs.date >= "2000/03/23"
  order by gigs.'date', gigs.'start_time'

Note the 'date' and 'start_time'...  Because of the 's the query does not
work.  

Is there a way to not have the <dtml-sqlvar> tag return the 's to MySQL,
or is there another way I should be trying to do this?

Thanks for the help,

Jeff Robertson