[EMAIL PROTECTED] napisaƂ(a):
Grzegorz I do it through the SQL transformer:


###### map ######
<map:pipeline>
        <map:match pattern="checkParameters">
  <map:generate src="sql/checkParameters.xml"/>
        <map:transform type="sql">
        <map:parameter name="rid" value="{request-param:rid}"/>
        </map:transform>
        <map:serialize type="xml"/>
        </map:match>
</map:pipeline>

###### query ######
<document xmlns:sql="http://apache.org/cocoon/SQL/2.0";>
 <sql:execute-query>
  <sql:use-connection>datamed</sql:use-connection>
  <sql:query>
  SELECT * FROM report_parameter_map WHERE  report_id = '<sql:substitute-value 
name="rid"/>'
  </sql:query>
</sql:execute-query>
</document>
I see. SQL transformer is intended to be used in linear flows. I mean that you cannot choose pipeline execution depending on sql transformer result. You have two options: 1. Maintain your conditional processing in XSL file (produce content depending on result of sql transformer) 2. Use flowscript in conjunction with some library/framework for accessing DB. May it be Hibernate, JDBI or plain JDBC. For JDBI, take a look at Forms samples to see how to use it.

First option is hacky and, in general, bad idea if your cases are really different depending on data from DB. The advantage of this method is that you don't have to learn anything new and quickly get desired results. Use it only if it's only exceptional need for such solution.

Second option requires more knowledge but in long-term it results in better design and separation of concerns that is really important concept in Cocoon. If you need simple DB access I suggest using JDBI as it's really simple and you have an example of integration with Cocoon, already.

Hope that helps you a little. Feel free to ask further.

--
Grzegorz Kossakowski

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

Reply via email to