cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haul <>
Subject Re: Database Insert Across Multiple Tables
Date Tue, 27 Apr 2004 22:08:00 GMT
Mike Dickson wrote:
> When you hit the "new user" button in the Modular Database Actions demo
> application it does a GET with the user info and the group info.  Why are
> only the user data listed below as params?  Shouldn't the group data be also
> listed as params?

Oh well, this is only a guard -- a condition that protects the 
invocation of the insert with a check that the most important attributes 
are present. The add action reads the data directly from the request.

> In other words, how are the group params being passed in?

Please have a look at the descriptor.xml (I've removed the comments):

    <table name="user_groups">
          <key name="uid" type="int">
             <mode name="request-param" type="request"/>
             <mode name="request-attr" type="attrib">
          <key name="gid" type="int" set="master">
             <mode name="request-param" type="all"/>

There are two <mode/> declarations for the UID column. The second is the 
one you may care about: It accesses a request attribute instead of a 
request parameter. The attribute will be set by the preceeding insert
to the users table! This is necessary, since the UID is a autoincrement 
column and the value is known only after the insert.

However, the "GID" data is read from a request parameter again (because 
it has been entered by the user on the form).


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message