cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bobby Mitchell <>
Subject Re: mod-db example not working.
Date Wed, 16 Oct 2002 14:31:49 GMT
Antonio Gallardo Rivera wrote:

>I am trying to start the example of mod-db using PostgreSQL.
>Currently, I have the autoincr, working, but the problem now is inserting a 
>new row in the table "groups" - the easier one ;).
>In the database.xml there is defined as:
><table name="groups">
>	<keys>
>		<key name="gid" type="int" autoincrement="true">
>			<mode name="auto" type="autoincr"/>
>		</key>
>	</keys>
>	<values>
>		<value name="gname" type="string"/>
>	</values>
><table-set name="groups">
>	<table name="groups"/>
>In the userlist.xsp there is a form that handle the new-group action:
>  <gname>
>    <form>
>      <input type="text" name="groups.gname" size="20" maxsize="20"/>
>      <input type="submit" name="add-group" value="new group"/>
>   </form>
> </gname>
>But when I try to Add a new group, It cannot get the groups.gname parameter. 
>It store a null. In the sitemap.log I found the following:
>Current Sitemap Parameters:
>PARAM: 'add-group' VALUE: 'new group'
>PARAM: 'groups.gname' VALUE: 'wsqa'
>PARAM: '../0' VALUE: 'user-list'
>PARAM: '../1' VALUE: 'user-list'
>Thread-9/DefaultComponentFactory: ComponentFactory creating new instance of 
>Thread-9/DefaultComponentFactory: no logger attribute available, using 
>standard logger
>Thread-9/AbstractComplementaryConfigurableAction: (Re)Loading database.xml
>Thread-9/DatabaseAction: modeTypes : {1=others, 2=attribute, 0=autoincr}
>Thread-9/DatabaseAction: i=0
>Thread-9/DatabaseAction: requested mode was "autoincr" returning "autoincr"
>Thread-9/DatabaseAction: i=1
>Thread-9/DatabaseAction: requested mode was "others" returning "others"
>Thread-9/DatabaseAction: query: INSERT INTO groups (gname) VALUES (?)
>Thread-9/DatabaseAction: Trying to set column groups.gname from request using 
>getAttribute method
>Thread-9/DatabaseAction: Setting column groups.gname [0] null
>Thread-9/DatabaseAction: ====> row no. 0
>Thread-9/DatabaseAddAction: Automatically setting key
>Thread-9/DatabaseAction: Setting column groups.gname[0] to null
>Thread-9/DatabaseAction: Could not select output mode attribute:null
>Thread-9/DatabaseAction: Setting column groups.gid[0] to 10
>Thread-9/DatabaseAction: Could not select output mode attribute:null
>Thread-9/DatabaseAction: Could not select output mode attribute:null
>Thread-9/DefaultComponentFactory: ComponentFactory decommissioning instance of  
>Also, the sitemap is:
>      <!-- add own new group -->
>      <map:act type="req-params">
>         <map:parameter name="parameters" value="add-group groups.gname"/>
>         <map:act type="mod-db-add">
>           <map:parameter name="table-set" value="groups"/>
>         </map:act>
>      </map:act>
>Please help,

Check the documentation at User Documentation/Actions/Database. Read 
closely the sections "How to obtain Values" and "How to store Values 
e.g. in your Session".

It's not completely clear, but it helps. Here are some examples from 
what I have done so far. I hope they are right.

1. Declaration of the modular action in the sitemap:
      <map:action name="mod-db-add"
        <!--  <throw-exception>true</throw-exception>  -->
        <!--  If this is set false, when the action fails it does not 
produce an error
                <!--This input module has to be described in 
cocoon.xconf. -->
                <!--Ditto for the output module-->
2. Define <map:act/> in the sitemap:
               <map:act type="mod-db-add" src="optional src" >
                <map:parameter name="descriptor" value="database.xml"/>
                <map:parameter name="table-set" value="<"table-set value"/>
                <!--  You can also map parameters for the action, such 
as <map:parameter name="throw-exception" value="true"/>  -->

Hope this helps.

>Antonio Gallardo.
>Please check that your question  has not already been answered in the
>FAQ before posting.     <>
>To unsubscribe, e-mail:     <>
>For additional commands, e-mail:   <>

Robert J. (Bobby) Mitchell
Systems Administrator
NASA Institute for Advanced Concepts
555A 14th St Atlanta, Ga. 30318
Phone: (404)347-9633 Fax: (404)347-9638

Please check that your question  has not already been answered in the
FAQ before posting.     <>

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

View raw message