You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Donald Ball <ba...@webslingerZ.com> on 2001/05/16 23:11:02 UTC
[c2] multi-add database action
someone (martin?) had posted a question regarding modifying berin's
database add action to add multiple rows to a table. i have a similar need
now. i want to add not just multiple rows to a table, i want to add
multiple rows to multiple tables from one form. after some pondering, i
was thinking a scheme like this might be good. the form descriptor would
be expanded to allow multiple tables, and the param attribute values could
have wildcards in them:
<map>
<table name="product_table">
<keys>
<key param="id" dbcol="id" type="int" mode="manual"/>
</keys>
<values>
<value param="name" dbcol="name" type="string"/>
</values>
</table>
<table name="product_meta_element_table">
<keys>
<key param="id" dbcol="product_id" type="int" mode="manual"/>
<key param="product_meta_element_name_*" dbcol="name" type="string"/>
</keys>
<values>
<value param="product_meta_element_value_*" dbcol="value" type="string"/>
</values>
</table>
</map>
for each request parameter that fit the wildcard pattern (e.g.
product_meta_element_name_1), if all other wildcarded parameters also had
a similarly named request parameter (product_meta_element_value_1), a row
would be inserted into the table.
any comments? berin, do your database actions handle multi-column primary
keys properly right now?
- donald
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: [c2] multi-add database action
Posted by Martin Man <Ma...@seznam.cz>.
On Fri, May 18, 2001 at 03:14:40PM -0400, Donald Ball wrote:
> On Fri, 18 May 2001, Martin Man wrote:
>
> > adding rows to multiple tables should be straight forward, multicolumn keys
> > work,
> >
> > these wildcards would mean iterating over all request parameters and trying
> > whether they match to the param attribute, can imagine code will be somehow
> > complicated :-)), but anyway good idea of implementing it, will take a look
> > into it after adding some new functionality to validator actions :))
>
> well i just checked in some code that does just that. i'm still trying to
cool, :-)
it's always a problem to be disconnected for more than one day,
> clean up the code and document some of the undocumented side effects that
> appear and there. suggestions are appreciated.
>
> - donald
martin
--
-------------------------------------------------------------------------------
"Only dead fish swims with a stream"
gpg_key_available: http://globales.cz/~mman/martin.man.gpg
gpg_key_fingerprint: 2CC0 4AF6 92DA 5CBF 5F09 7BCB 6202 7024 6E06 0223
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: [c2] multi-add database action
Posted by Donald Ball <ba...@webslingerZ.com>.
On Fri, 18 May 2001, Martin Man wrote:
> adding rows to multiple tables should be straight forward, multicolumn keys
> work,
>
> these wildcards would mean iterating over all request parameters and trying
> whether they match to the param attribute, can imagine code will be somehow
> complicated :-)), but anyway good idea of implementing it, will take a look
> into it after adding some new functionality to validator actions :))
well i just checked in some code that does just that. i'm still trying to
clean up the code and document some of the undocumented side effects that
appear and there. suggestions are appreciated.
- donald
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: [c2] multi-add database action
Posted by Martin Man <Ma...@seznam.cz>.
On Wed, May 16, 2001 at 05:11:02PM -0400, Donald Ball wrote:
> someone (martin?) had posted a question regarding modifying berin's
no not me ;-)
> database add action to add multiple rows to a table. i have a similar need
> now. i want to add not just multiple rows to a table, i want to add
> multiple rows to multiple tables from one form. after some pondering, i
> was thinking a scheme like this might be good. the form descriptor would
> be expanded to allow multiple tables, and the param attribute values could
> have wildcards in them:
>
> <map>
> <table name="product_table">
> <keys>
> <key param="id" dbcol="id" type="int" mode="manual"/>
> </keys>
> <values>
> <value param="name" dbcol="name" type="string"/>
> </values>
> </table>
> <table name="product_meta_element_table">
> <keys>
> <key param="id" dbcol="product_id" type="int" mode="manual"/>
> <key param="product_meta_element_name_*" dbcol="name" type="string"/>
> </keys>
> <values>
> <value param="product_meta_element_value_*" dbcol="value" type="string"/>
> </values>
> </table>
> </map>
adding rows to multiple tables should be straight forward, multicolumn keys
work,
these wildcards would mean iterating over all request parameters and trying
whether they match to the param attribute, can imagine code will be somehow
complicated :-)), but anyway good idea of implementing it, will take a look
into it after adding some new functionality to validator actions :))
>
> for each request parameter that fit the wildcard pattern (e.g.
> product_meta_element_name_1), if all other wildcarded parameters also had
> a similarly named request parameter (product_meta_element_value_1), a row
> would be inserted into the table.
>
> any comments? berin, do your database actions handle multi-column primary
> keys properly right now?
>
> - donald
>
martin
--
-------------------------------------------------------------------------------
"Only dead fish swims with a stream"
gpg_key_available: http://globales.cz/~mman/martin.man.gpg
gpg_key_fingerprint: 2CC0 4AF6 92DA 5CBF 5F09 7BCB 6202 7024 6E06 0223
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org