[Zope] Variable as record type or dictionary

Juan Carlos Coruņa jcoruna@umd.es
Fri, 31 Mar 2000 16:24:31 +0200


Hi Zopists!

I need to copy a record from into a <dtml-in> tag to use it later.

Suppose:

"Client" is a select ZSQL method (select * from Client where <dtml-sqltest
client_num type=string>).
----
<dtml-in "Client(client_num='2345')">
  copy the retrieved record in a variable
</dtml-in>
----
"OrderLine" is a insert ZSQL method:

insert into OrderLine
  (order_num,client_num,client_name,client_address,...,product_num,...)
values
  (<dtml-sqlvar order_num type=string>,
   insert the column "client_num" from the previous retrieved Client record,
   insert the column "client_name" from the previous retrieved Client
record,
   insert the column "client_address" from the previous retrieved Client
record,
   ...,
   <dtml-sqlvar product_num type=string>,
   ...)
----
Registering the order lines...
<dtml-call "OrderLine(order_num='OR4567',product_num='PENCIL-0067')">
<dtml-call "OrderLine(order_num='OR4568',product_num='PEN-BLUE-8')">
<dtml-call "OrderLine(order_num='OR4569',product_num='PENCIL-0045')">
<dtml-call "OrderLine(order_num='OR4570',product_num='PENCIL-0023')">
<dtml-call "OrderLine(order_num='OR4571',product_num='PEN-BLCK-1')">
<dtml-call "OrderLine(order_num='OR4572',product_num='PEN-031')">

----

Take in mind that I can't put the ZSQL method "Client" inside the ZSQL
method "OrderLine" because the Client method needs about 10 seconds to
execute and if every "OrderLine" method needs his time plus 10 seconds (from
the "Client" method) this can take over one minute for the above example
order. This is not viable! Awaiting 15 seconds to place the order is
acceptable but over one minute isn't.

The solution is to execute the "Client" method only one time. Any ideas how
can I copy the Client record?

Juan Carlos Coruņa.