On 06.Feb.2002 -- 03:21 PM, Malte Vahlenkamp wrote:
> Hello,
> is there a way, to insert the data of an HTML-Form into more than one database 
>table? I have tried to do this via a database action 
>(org.apache.cocoon.acting.DatabaseAddAction) and the following mapping: 
> 
>   <table name="projects">
>     <keys>
>       <key param="ProjectId" dbcol="projectid" type="int" mode="manual"/>
>     </keys>
>     <values>
>       <value param="ProjectName" dbcol="projectname" type="string"/>
>       <value param="UserId" dbcol="userid" type="string"/>
>     </values>                             
>     
>    <table name="userprojects">                                    
>       <keys>
>         <key param="ProjectId" dbcol="projectid" type="int"/>
>       </keys>
>       <values>                                        
>         <value param="UserId" dbcol="userid" type="int"/>
>       </values>    
>    </table>                   
>  </table>                     
> 
> This mapping works fine for the first table, but tries to insert a ProjectId of NULL 
>into the second table. What I want is to insert the generated key of the first table 
>instead.

AFAIK Database Action sets request attributes with the following
naming scheme

"org.apache.cocoon.acting.AbstractDatabaseAction:"+key

so you'd need to read from
org.apache.cocoon.acting.AbstractDatabaseAction:ProjectId and hope
that there's no request parameter of that name because it will have
precedence. 

Although still not prime time (helper handling needs complete redo)
you might want to check out the ModularDatabaseActions from the
scratchpad directory. I wouldn't advise using them for mission
critical work right now because they will change a bit before they
will migrate to the main trunk but it might still be worth a look.
Note that their descriptor format differs from the above.

BTW: one closing tag </table> seems to be misplaced above.

        Chris.

-- 
C h r i s t i a n       H a u l
[EMAIL PROTECTED]
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to