[Zope] Zope, PostgreSQL 6.5, and some newbie questions

Jeffrey Shell Jeffrey@digicool.com
Tue, 15 Jun 1999 18:59:07 -0400


> From: Phillip J. Eby [mailto:pje@telecommunity.com]
> 
> >3) In order to keep the DTML uncluttered, I've created dtml 
> methods to render
> >   things like HTML selections.  Two questions.: First, how 
> do I access them
> >   if I move them to a subfolder in the same folder as the 
> dtml document?
> 
> <!--#with subfolder--><!--#var method--><!--#/with-->
> 
> Or:
> 
> <!--#var "_.render(subfolder.method)"-->
> 
> 
> >   Second, how do I pass parameters to the dtml methods?
> 
> <!--#with subfolder-->
> <!--#var "method(None,_,var1=val,var2=val)"-->
> <!--#/with-->

I like using render here too, it's a tad more reliable (in my mind) when
used with namespace.

<!--#with subfolder-->
 <!--#with "_.namespace(var1='valerie', val2='call me')"-->
  <!--#var method--> (i'm the same man i used to be)
 <!--#/with-->
<!--#/with-->

It's no less elegant than the (_.None, _)

Cary O'Brien::
> 4) Can Z SQL methods return anything?  After an insert I'd like to get
>    some more information.

What sort of information?  You can have as many SQL statements in a SQL
method as you want (seperating them with <!--#var sql_delimiter-->), but
only one select statement.  Some databases (like Sybase) tend to return
information on inserts, create tables, etc; others don't.  You can
follow up an INSERT statement with a SELECT statement in the same SQL
method and you should get information back, but (especially where
transactional databases are concerned) you might not always get back the
record you just inserted (usually what people like to do just after
inserting).

If you don't need the record back that you just inserted, you can put
them into two seperate methods and call them in the same DTML
Method/Document::

<!--#call sqlMyInsertQuery-->
<UL>
<!--#in sqlMyBigSelectQuery-->
 <LI><!--#var something--></LI>
<!--#/in-->
</UL>

Remember, #call won't insert anything into the generated HTML, so even
if it's the type of database that likes to return status tables on
inserts, it won't affect the DTML.

and when all else fails, experiment :)