I have a DatabaseAction with the followed descriptor <?xml version="1.0"?> <tabelle> <connection>line_db</connection> <table name="t_news"> <keys> <key param="numprg" dbcol="numprg" type="int" mode="manual"/> </keys> <values> <value param="datpub" dbcol="datpub" type="date" > </value> </values> </table> </tabelle>
How i can use the DateMetaInputModule or DateInputModule to format date "datpub" to 'dd/MM/yyyy'? Thanks, Marco > -----Messaggio originale----- > Da: Christian Haul [mailto:[EMAIL PROTECTED]] > Inviato: lunedi 17 febbraio 2003 9.54 > A: [EMAIL PROTECTED] > Oggetto: Re: MySQL date conversion with modular database action > > > On 15.Feb.2003 -- 01:44 AM, Andre Taube wrote: > > Any pointers on how to convert a date before it's inserted into MySQL > > database while using cocoon's Modular Database Action? > > > > I tried > > > > <value name="start_date" type="date"> > > <mode name="attribute" > > > parameter="org.apache.cocoon.components.modules.input.DateMetaInpu > tModule:start_date[0]" > > type="attrib"/> > > </value> > > > > It seems this "mode" parameter is being ignored. > > Hi. You don't include all involved configuration lines so let's > analyse only the above mode element: > > @name -> use the input module known as "attribute". This used to be > the one operating on request attributes. This has been > renamed to "request-attr" for default configurations. > Make sure there is an input modules with short-hand > "attribute"! > > @parameter -> interpretation depends on the input module used. Not all > modules accept this parameter. For the request attribute > module, this is the name of the request attribute to use > instead of the one actually passed to the getAttribute() > method. The default name generated by the database > actions is > "table.column" > Make sure that this attribute exists and contains a > compatible value! > > @type -> By placing XML-attributes "others-mode" or > "autoincrement-mode" to the <table/> elements inside the > <table-set/> elements, different modes can be > selected. This > mode is only used when the table in the table-set has the > XML-attribute others-mode="attrib" > Make sure that this is the case! > > But I reckon that you really wanted to write > > <value name="start_date" type="date"> > <!-- if "attrib" is requested, convert string to a Date using the > date conversion module --> > <mode name="datemeta" type="attrib"> > <!-- pass the following as attribute name to the nested module --> > <parameter>start_date</parameter> > <!-- use the request parameter module to obtain the string --> > <input-module name="request-param"/> > </mode> > </value> > > or the like. > > BTW if you were using a recent snapshot (of either branch), then you > might not need to convert a string to a date if it is a valid SQL date > representation. > > 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 > > --------------------------------------------------------------------- > 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]> > > --------------------------------------------------------------------- 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]>