![]() | ![]() | SQLTransformerWarning Note that this does not match the Cocoon
method 100%. There are important differences that are discussed in the How2 example. SQL Transformers provide an interface between Paloose and SQL-savvy database engines. They take a query and return the results of that query to the pipeline (or a suitable error message). A typical declaration of the SQLTransformer component would be: <map:transformers default="xslt">
<map:transformer name="mysql" src="resource://lib/transforming/SQLTransformer">
<map:parameter name="type" value="mysql"/>
<map:parameter name="host" value="localhost:3306"/>
<map:parameter name="user" value="root"/>
<map:parameter name="password" value="*******"/>
</map:transformer>
<map:transformer name="xslt" src="resource://lib/transforming/TRAXTransformer">
<map:use-request-parameters>true</map:use-request-parameters>
</map:transformer>
</map:transformers> where
The pipeline would then be: <map:pipeline>
<map:match pattern="**.html">
<map:generate src="context://content/{1}.xml" label="xml-content"/>
<map:transform type="mysql" label="sql-transform">
<map:parameter name="show-nr-of-rows" value="true"/>
</map:transform>
...
</map:match> where
For an example of how to use the SQLTransformer and an explanation of the various attributes see the example How2 page. ErrorsErrors from the database engine are reported in the following typical fashion <page:content xmlns:default="http://apache.org/cocoon/SQL/2.0" xmlns:t="http://www.hsfr.org.uk/Schema/Text">
<t:heading level="1">SQL Transform Test</t:heading>
<default:sql-error xmlns="http://apache.org/cocoon/SQL/2.0">
<default:host>localhost:3306</default:host>
<default:user>root</default:user>
<default:password></default:password>
<default:message>SQL query error: => query: select * fom composer </default:message>
</default:sql-error>
</page:content> | ![]() |


