cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haul <>
Subject Re: MySQL date conversion with modular database action
Date Fri, 21 Feb 2003 14:26:12 GMT
On 19.Feb.2003 -- 11:45 AM, Andre Taube wrote:
> Still the same:
> DEBUG   (2003-02-19) 12:28.28:239   [sitemap.action.DatabaseUpdateAction]
> (/pcm/contract_admin.contract.html) Thread-9/DatabaseAction: Trying to set
> column pcm_contract.contract_status from request-param using getAttribute
> method

OK, let's look at the samples for the database actions. Let's add a
date column to user:

   alter table add column since date;

(use org.hsqldb.util.DatabaseManager to connect to the server at port
9002 to do this or edit cocoondb.script accordingly)

Change database.xml: (Note: a typo prevented specifying parameter and
format like below. Update the Date* files from CVS -- don't
update everything yet, Stefano is tweaking the build system and you
might not be able to build a new CVS version right away.)

   <table name="user" alias="user">
         <key name="uid" type="int" autoincrement="true">
            <mode name="auto"  type="autoincr"/>
         <value name="name"      type="string"></value>
         <value name="firstname" type="string"></value>
         <value name="uname"     type="string"></value>

		 <!-- this is new -->
         <value name="since"     type="date">
           <mode name="datemeta" type="all">
             <input-module name="request-param"/>

         <!-- end new stuff -->


I have used the @type="all" here, since I alway want to convert dates

Add the following to user-list.xsp:

      <esql:get-date column="since" format="MM/dd/yy"/>


      <input type="text" name="user.since" size="20" maxsize="20">
        <xsp:attribute name="value"><!-- <xsp-request:get-parameter default=""
name="user.uname"/> --></xsp:attribute>

I trust you figure out where to add this ;-)

Please veryfy that this does indeed work for you.

Now, let's look at the other issue: using a different mode for an
operation. Look at the following table-set

   <table-set name="user+groups">
      <table name="user"/>
      <table name="user_groups" others-mode="attrib"/>

and compare with the table definition below

   <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"/>

Now, look at sitemap.log (note: default recently switched to log level
ERROR, make sure you have set log level in web.xml and logkeit.xconf

 DatabaseAction: modeTypes : {1=attrib, 2=request-attr, 0=autoincr}

this line shows that we are really using "attrib" for others-mode,
"request-attr" for output and "autoincr" for autoincrement columns
(when inserting)

 DatabaseAction: i=0
 DatabaseAction: requested mode was "attrib" returning "attrib"

this shows that we're indeed requesting "attrib" as mode for the first
column (-> user_groups.uid) and that it was found.

 DatabaseAction: i=1
 DatabaseAction: requested mode was "attrib" returning "all"

again, "attrib" was requested but "all" is found (first) thus the mode
with @type="all" is used for column 2 (-> user_groups.gid)

 DatabaseAction: query: INSERT INTO user_groups (uid, gid) VALUES (?, ?)
 DatabaseAction: Trying to set column user_groups.uid from request-attr using getAttribute
 DatabaseAction: Setting column user_groups.uid [0] 6
 DatabaseAction: Trying to set column user_groups.gid from request-param using getAttributeValues
 DatabaseAction: Setting column user_groups.gid [0] 0
 DatabaseAction: ====> row no. 0
 DatabaseAction: Setting column user_groups.uid[0] to 6
 DatabaseAction: Setting column user_groups.gid[0] to 0
 DefaultComponentFactory: ComponentFactory decommissioning instance of org.apache.cocoon.acting.modular.DatabaseAddAction.


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

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

View raw message