cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haul <h...@dvs1.informatik.tu-darmstadt.de>
Subject Re: MySQL date conversion with modular database action
Date Mon, 17 Feb 2003 08:53:45 GMT
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.DateMetaInputModule: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
haul@informatik.tu-darmstadt.de
    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:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message