Thanks to Christian and Leo for the suggestions related
to a "comprehensive" database sample.  I think, though, that
I am trying to get things simpler and not more complex.
ie. aim for more and easier reuse of the existing codebase
and approaches, rather than adding in more code and
more approaches...

I was wondering if there was a simple (straightforward?)
way of rewriting the sample pattern for using modular
database actions, in such a way that they can scale more
easily to handle a large (and variable) number of tables.
(ASSUMING that no complex transaction logic is involved)

The sample in $COCOON/samples/databases/mod-db sitemap has:

<!-- add new groups to a user's groups -->
<map:act type="req-params">
  <map:parameter name="parameters" value="add-groups user_groups.uid
user_groups.gid"/>
  <map:act type="mod-db-add">
  <map:parameter name="table-set" value="user_groups"/>
  </map:act>
</map:act>

<!-- add one new group -->
<map:act type="req-params">
  <map:parameter name="parameters" value="add-group groups.gname"/>
  <map:act type="mod-db-add">
    <map:parameter name="table-set" value="groups"/>
  </map:act>
</map:act>

AND

<!-- delete one user -->
<map:act type="req-params">
  <map:parameter name="parameters" value="del-user user.uid"/>
  <map:act type="mod-db-del">
    <map:parameter name="table-set" value="user"/>
  </map:act>
</map:act>

<!-- delete one group -->
<map:act type="req-params">
  <map:parameter name="parameters" value="del-group groups.gid"/>
  <map:act type="mod-db-del">
    <map:parameter name="table-set" value="groups"/>
  </map:act>
</map:act>


This approach means that for each new table or table group you 
need to create a new set of entries in the sitemap.  I was
wondering if it is possible to set up a handling mechanism 
where the number of tables (and their various keys) are NOT
known in advance.   Perhaps something that looks like:


<map:match pattern="add/*">
  <map:act type="mod-db-add">
    <map:parameter name="table-set" value="{1}"/>
  </map:act>
</map:match>

AND

<map:match pattern="delete/*">
  <map:act type="mod-db-delete">
    <map:parameter name="table-set" value="{1}"/>
  </map:act>
</map:match>

where * would be the name of the table-set involved,
BUT - I am not sure how and where to define what request 
parameters need to get handled - if any?  

Any help and/or advice with this would be gratefully
received.

Derek

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.


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

Reply via email to