[Zope] strange sql problem
Dieter Maurer
dieter@handshake.de
Thu, 27 Jun 2002 19:47:15 +0200
Aseem Mohanty writes:
> ...
> The problem is if I place A in join_sql_methods it works perfectly and
> returns me the relevant data item. However if I place A in
> util_sql_methods it returns an empty result set.
>
> My DTML method looks like
>
> <dtml-call "B">
> <dtml-call "join_sql_methods.A"> in the former case
>
> and
>
> <dtml-call "B">
> <dtml-call "util.util_sql_methods.A"> in the latter case.
I strongly recommend background reading (Zope book or
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
) and much more care when programming or problem reporting!
First:
when you use "dtml-call" you should not expect any result!
It discards any return values.
Both cases above will not show anything.
Second:
when you use a ZSQL Method inside "...", it is not
automatically called. You need to do it explicitly.
Otherwise, you get the ZSQL Method itself (and not its
result).
Try: '<dtml-var "_.len(XXXX.A())">'.
If you were careful when programming and only careless when
reporting your problem, you may use the "src__" parameter of
Z SQL Methods. When set to a true value, the method will return
the generated SQL command but not execute it.
This is often very helpful to analyse problems with Z SQL Methods.
Dieter
PS: At least me, I expect that problems are reported with great care.
This means, that your problem report should contain "dtml-var",
when your DTML code does.
Only carefully prepared problem reports provide the base
for an efficient response.