[Zope] Accessing a Database

Matt Standish mps@bloomington.in.us
30 May 2002 12:04:45 -0500


On Wed, 2002-05-29 at 21:12, Stephan Vladimir Bugaj wrote:
> I'm trying to do a "like" query in a database...
> 
> I've created a ZSQL thing like this
> select foo,bar from xxx
> <dtml-sqlgroup where>
>   <dtml-sqltest ABC op=like type=string>
> </dtml-sqlgroup>
> order by foo
> 

I run SQL a little different. 

First I set my variables.
<dtml-call expr="REQUEST.set('uid',AUTHENTICATED_USER)">

Then I call the SQL
<dtml-in sqlQuery_sql>
<dtml-var results>
</dtml-in>

The SQL contains:

select * from Software_Problem_Reports where
Problem_Summary like "<dtml-var Problem_Summary>%"

I don't know if this is correct but it works for me.


> Finally, if I've got this structure:
> 
> ROOT ---------------------> (ZSQL scripts folder)
>            |--------------------->(Some folder containing some DTML stuff)
> 
> How can I call the ZSQL scripts from their folder?  They're not being 
> acquired
> because they are not above the DTML stuff in the heirarchy.
> 
Using <dtml-with> maybe?

-Matt