cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Gallardo" <>
Subject [SUMMARY] Actions and Modular Databases Actions
Date Thu, 22 May 2003 04:13:52 GMT
Hi Chris:

Thanks for your advise, it help us to decide the way we solved this. With
two pipelines, one public and one internal.

<!-- Public pipeline -->
<!-- Call a Custom Action to generate data before insert-->
1- <map:match type="request-parameter" pattern="cocoon-action-Generate">
2-   <map:act type="xsp-action" src="prepare-data.xsp">
3-     <map:parameter name="param1" value="{request-param:param1}"/>
4-     <map:parameter name="param2" value="{request-param:param2}"/>
5-     <map:parameter name="param3" value="{request-param:param3}"/>
6-     <map:parameter name="param4" value="{request-param:param4}"/>
7-     <map:redirect-to uri="cocoon:raw://{insert_pipeline}"/>
8-   </map:act>
9- </map:match>

The Action (line 2) query data from the databse and returns the URI
"insert_pipeline" that is called at line 7. "insert_pipeline" looks like:

executeinsert?param1=1&param2=2&param3=3 ......

Of course into the internal pipeline that process the line 7 there is a
traditional modular database insert action.

I dont know if this is the best practices or a elegant solution that but
this works. But I think is secure. The prepared data in line 2 are
inserted in 3 tables where is a cascade master-details, master-detail.

By the way we dont liked the idea to make another database_pool with
<autocommit>false</autocommit> and control all the BEGIN TRANSACTION,
COMMIT and ROLLBACK into the Action. I think this will be a very ugly

I attached a diagram that describes what we did.

Well thanks for your advise again.

Beest Regards,

Antonio Gallardo.

Christian Haul dijo:
> On 20.May.2003 -- 07:31 PM, Antonio Gallardo wrote:
>> Hi:
>> I have the following scenario:
>> I need to generate some data based on a request from the user. The
>> problem is that this data will use more than 1 table. Then we need to
>> use Database transactions. We also know that Modular Database Actions
>> are
>> transactional. They can do the work.
>> After thinking about the solution of this problem, we tought that in
>> order to prepare the data before the use of "DatabaseAddAction". We
>> need to build an Action. Here is a scratch of the sitemap:
>> 1- <map:match pattern="resultpage">
>> 2-  <map:action type="preparedata">
>> 3-    <map:action type="mod-db-add">
>> 4-      <map:parameter name="table-set" value="my_table_set"/>
>> 5-       <map:generate ......>
>> 6-    </map:action>
>> 7-    <!-- error cannot insert into database -->
>> 8-  </map:action>
>> 9-  <!-- error, cannot prepare data -->
>> 10 </map:match>
>> The question is:
>> If we will store the data into line 2, the action will return new data
>> into a "map" (As normal). But I dont know how to tell that the
>> parameters will come from returned map and not from the traditional:
> Indeed, there is currently no way for an input module to get at the
> sitemap variables. I fear it's not easily hackable because
> aggregations and includes share the same request IIRC.
> So you need to store your data that is accessible from a
> module. Request attributes come to mind for this.
> Another idea could be to prepare the data in a module. Of course this
> depends on the complexity of the preparation and the dependencies
> among the values.
> 	Chris.
> --
> C h r i s t i a n       H a u l
>     fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08
> --------------------------------------------------------------------- To
> unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message