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>
>
>Also....
>
><table-set name="groups">
>       <table name="groups"/>
></table-set>
>
>In the userlist.xsp there is a form that handle the new-group action:
>
><sqltblrow>
>  <gname>
>    <form>
>      <input type="text" name="groups.gname" size="20" maxsize="20"/>
>      <input type="submit" name="add-group" value="new group"/>
>   </form>
> </gname>
></sqltblrow>
>
>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:
>LEVEL 2
>PARAM: 'add-group' VALUE: 'new group'
>PARAM: 'groups.gname' VALUE: 'wsqa'
>LEVEL 1
>PARAM: '../0' VALUE: 'user-list'
>PARAM: '../1' VALUE: 'user-list'
>
>Thread-9/DefaultComponentFactory: ComponentFactory creating new instance of 
>org.apache.cocoon.acting.modular.DatabaseAddAction.
>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  
>org.apache.cocoon.acting.modular.DatabaseAddAction.
>
>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"
        src="org.apache.cocoon.acting.modular.DatabaseAddAction">
        <!--  <throw-exception>true</throw-exception>  -->
        <!--  If this is set false, when the action fails it does not 
produce an error
        <input>request-parameter</input>  
                <!--This input module has to be described in 
cocoon.xconf. -->
        <output>session-attribute</output>
                <!--Ditto for the output module-->
      </map:action>
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"/>  -->
              </map:act>

Hope this helps.



>Regards,
>
>Antonio Gallardo.
>
>---------------------------------------------------------------------
>Please check that your question  has not already been answered in the
>FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
>To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
>For additional commands, e-mail:   <[EMAIL PROTECTED]>
>  
>


-- 
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.     <http://xml.apache.org/cocoon/faq/index.html>

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

Reply via email to