Christian Haul dijo:
I've tried all the solutions you suggested to me but it doesn't work and I can't find anything in the log files :(
Please change the log level for sitemap to debug and look again.
Which version of Cocoon are you using?
I may have badly explain my problem...because I don't want to update a key field. As my english is poor, I think that an example is better than a long explanation.
In my table I've the following records : idA idB idC idD MyString ------------------------ 1 3 5 6 1 3 5 7 1 5 5 9
And after the update, I want something like that :
idA idB idC idD MyString ------------------------ 1 3 5 6 hello 1 3 5 7 world 1 5 5 9 !
Right. I have made a small sample (although it uses only 2 keys) which does that. Please create a new table according to schema.sql and put the other files into e.g. $HOME/public_html and go to http://localhost:8888/~acordier/ (in case you are running 2.1-dev on unix) The sample uses the personnel connection.
Here is a sample of code that I've tried. I've put idD either as a key or as a value but with no results.
<table name="mytable"> <keys> <key name="idA" type="int"> <mode name="request-param" type="request"/> </key> <key name="idB" type="int"> <mode name="request-param" type="request"/> </key> <key name="idC" type="int"> <mode name="request-param" type="request"/> </key> <key name="idD" type="int" set="master"> <mode name="request-param" type="request"/> </key> </keys> <values> <value name="MyString" type="string" set="slave"/> </values> </table>
Once again, I'm lost
This looks fine. The logs should shed some light on this.
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
-- a simple table to test multiple updates
create table foo ( a int, b int, c varchar, primary key (a,b) );
<?xml version="1.0"?> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> <map:components> <map:actions> <map:action name="mod-db-add" src="org.apache.cocoon.acting.modular.DatabaseAddAction"> <descriptor>database.xml</descriptor> <throw-exception>true</throw-exception> </map:action> <map:action name="mod-db-del" src="org.apache.cocoon.acting.modular.DatabaseDeleteAction"> <descriptor>database.xml</descriptor> <throw-exception>false</throw-exception> </map:action> <map:action name="mod-db-upd" src="org.apache.cocoon.acting.modular.DatabaseUpdateAction"> <descriptor>database.xml</descriptor> <throw-exception>false</throw-exception> </map:action> <map:action name="req-params" src="org.apache.cocoon.acting.RequestParameterExistsAction"/> </map:actions> </map:components> <map:views> <map:view name="content" from-label="content"> <map:serialize type="xml" mime-type="text/plain"/> </map:view> </map:views> <map:pipelines> <map:pipeline> <!-- ========================== Modular DB ================================= --> <map:match pattern=""> <map:redirect-to uri="foo"/> </map:match> <map:match pattern="*"> <map:act type="req-params"> <map:parameter name="parameters" value="add"/> <map:act type="mod-db-add"> <map:parameter name="table-set" value="add"/> </map:act> </map:act> <map:act type="req-params"> <map:parameter name="parameters" value="update"/> <map:act type="mod-db-upd"> <map:parameter name="table-set" value="update"/> </map:act> </map:act> <map:act type="req-params"> <map:parameter name="parameters" value="delete"/> <map:act type="mod-db-del"> <map:parameter name="table-set" value="delete"/> </map:act> </map:act> <map:generate type="serverpages" src="{1}.xsp"/> <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl"> <map:parameter name="servletPath" value="{request:servletPath}"/> <map:parameter name="sitemapURI" value="{request:sitemapURI}"/> <map:parameter name="contextPath" value="{request:contextPath}"/> <map:parameter name="file" value=".xsp"/> </map:transform> <map:serialize/> </map:match> </map:pipeline> </map:pipelines> </map:sitemap>
<root>
<connection>personnel</connection>
<table name="foo">
<keys>
<key name="a" type="int" autoincrement="false">
<mode name="request-param" type="all"/>
</key>
<key name="b" type="int" autoincrement="false" set="master">
<mode name="request-param" type="all"/>
</key>
</keys>
<values>
<value name="c" type="string" set="slave">
<mode name="request-param" type="all"/>
</value>
</values>
</table>
<table-set name="add">
<table name="foo"/>
</table-set>
<table-set name="update">
<table name="foo"/>
</table-set>
<table-set name="delete">
<table name="foo"/>
</table-set>
</root>
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
>
<page>
<resources>
<resource type="file" href="database.xml">Descriptor</resource>
<resource type="file" href="schema.sql">Schema</resource>
<resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource>
<resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource>
</resources>
<title>foo</title>
<content>
<h1>ModDB - Test Multiple Updates</h1>
<h2>Current database content</h2>
<esql:connection>
<esql:pool>personnel</esql:pool>
<p>
<table>
<tr>
<th>A</th><th>B</th><th>C</th>
</tr>
<esql:execute-query>
<esql:query>select * from foo order by a,b</esql:query>
<esql:results>
<esql:row-results>
<esql:group group-on="a">
<form>
<esql:member>
<tr>
<td>
<input name="foo.a" type="text" size="3" readonly="true">
<xsp:attribute name="value"><esql:get-int column="a"/></xsp:attribute>
</input>
</td>
<td>
<input name="foo.b" type="text" size="3" readonly="true">
<xsp:attribute name="value"><esql:get-int column="b"/></xsp:attribute>
</input>
</td>
<td>
<input name="foo.c" type="text" size="20">
<xsp:attribute name="value"><esql:get-string column="c"/></xsp:attribute>
</input>
</td>
</tr>
</esql:member>
<tr>
<td colspan="3" align="right">
<input type="submit" name="update" value="update column c"/>
</td>
</tr>
</form>
</esql:group>
</esql:row-results>
</esql:results>
<esql:error-results>
<error><esql:get-message/></error>
</esql:error-results>
</esql:execute-query>
<form>
<tr>
<td>
<input type="text" size="4" name="foo.a"/>
</td>
<td>
<input type="text" size="4" name="foo.b"/>
</td>
<td>
<input type="text" size="20" name="foo.c"/>
<input type="submit" name="add" value="add row"/>
</td>
</tr>
</form>
</table>
</p>
</esql:connection>
</content>
</page>
</xsp:page>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
