[Zope] Accessing a Database

Stephan Vladimir Bugaj sbugaj@pixar.com
Wed, 29 May 2002 19:12:16 -0700


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

Now, in the documentation, it claims that the dtml-sqltest operation "like" 
puts a %
at the end of the input string.  This is false.  So I'm trying to 
force-feed a % to it to
no avail...

Putting a % into any DTML seems to indicate an end of file character. 
Nice.  So just
how does one go about actually doing a non-exact string match from Zope 
against
a relational DB?

Also, I had tried:
<ul>
<dtml-in expr="zsqlthingy(ABC=Blah)">
  <li> <dtml-var login>  <dtml-var phone>
  </li>
</dtml-in>
</ul>

And it tells me "global name Blah is not found"... I had to go create a 
DTML Method
called Blah that contains just the line "<dtml-return "Blah">"... is there 
some way to
just pass a string value (or numerical value) where a string (or number) 
are expected
as input?

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.

Thanks.

LL+P,
Stephan