[Zope] strange sql problem

Aseem Mohanty aseem@neurobehavioralsystems.com
Thu, 27 Jun 2002 01:35:57 -0700


I am sorry, there was a typo in the email... just having a bad day, 
second typo since morning...

The second call is actually a

<dtml-var "join_sql_methods.A">

I agree <dtml-call.. does not return anything. As for the link I have 
already gone through that some time back based on an earlier answer you 
gave to somebody else. However I couldnt find an explanation to the prob 
I am having.

I will restate it for clarity :

I have the following directory structure:

join\
   create_method
   join_sql_methods\
util\
   util_sql_methods\

Now I have a simple sql method A that reads in a value in a db table TB.

In create_method I call a sql method B in join_sql_methods which creates 
a record in the table TB. In the same method after the call to create 
(B) I call the above mentioned sql method (A) to read off the value from 
the newly created record.

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.

*** it only happens when I am creating and querying the same record, 
former works, latter doesnt ***

My DTML  create_method looks like

<dtml-call "B">
<dtml-var "join_sql_methods.A"> in the former case

and

<dtml-call "B">
<dtml-var "join_sql_methods.A"> in the latter case.

Also as far as any problems/uncertainities calling a ZSQL method might 
create, I tried to get around that by using a begin... query ... commit 
  style ZSQL method. Thus even when the actual DTML method raises an 
error the record is created correctly. Thus either both should work or 
both should fail. I also checked access rights to both the folders and 
made sure they are exactly the same so that there were no problems, 
however since an unauthorized is not raised, I dont think thats the 
problem. Essentially I am running out of possible sources of problems.

I apologize again for the screw-up and will be eternally grateful for 
any ideas.
TIA
AM

>
>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.
>
>
>_______________________________________________
>Zope maillist  -  Zope@zope.org
>http://lists.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists - 
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>
>

-- 
==================================================================
 Aseem Mohanty							   
 Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 
 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231		  	
==================================================================								  	
 "I saw `cout' being shifted "Hello world" times to the left and  
  stopped right there!!"                        -- Steve Gonedes  
==================================================================