cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haul <h...@informatik.tu-darmstadt.de>
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">
       <keys>
          <key name="uid" type="int">
             <mode name="request-param" type="request"/>
             <mode name="request-attr" type="attrib">
 
<parameter>org.apache.cocoon.components.modules.output.OutputModule:user.uid[0]</parameter>
             </mode>
          </key>
          <key name="gid" type="int" set="master">
             <mode name="request-param" type="all"/>
          </key>
       </keys>
    </table>

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).

	Chris.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message