cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pasha Minallah <pa...@neptuneinc.org>
Subject Re: DatabaseSelectAction
Date Tue, 14 Feb 2006 02:13:34 GMT
On Sunday 12 February 2006 23:48, Derek Hohls wrote:
>
> You description here is a little limited, but, I assume
> you have sucessfully authenticated a user and have an
> ID for them.

Yes, that is correct.  The user is authenticated using the 
DatabaseAuthenticatorAction and two variables (sid and survey) are stored in 
the session using the tosession attribute (as strings).

> You could then call a flow script, which picks up the ID
> from the session; the SQL could be run from inside flow
>  and the result then stored in a new session attribute.
> You are correct in saying there is a not a single description
> of this activity in the docs; but you will be able to find the
> info you need by looking at the samples, and also searching
> the mail archives.

Thanks for pointing me to the samples.  They helped but didn't solve my 
problem.

Here are the details.

Sitemap Pipeline Matcher:

      <map:match pattern="test/query">
        <map:act type="mod-db-sel">
          <map:parameter name="descriptor" 
value="web/system/db/descriptor.xml"/>
          <map:parameter name="table-set" value="students"/>
          <map:parameter name="output" value="session"/>
          
          <map:call resource="debug-params">
            <map:parameter name="param1" value="{session-attr:sid}"/>
            <map:parameter name="param3" value="{session-attr:survey}"/>
            <map:parameter name="param4" value="Success!"/>
            <map:parameter name="param5" 
value="{session-attr:students.survey}"/>
          </map:call>
        </map:act>
        
        <map:call resource="debug-params">
          <map:parameter name="param1" value="{session-attr:sid}"/>
          <map:parameter name="param3" value="{session-attr:survey}"/>
          <map:parameter name="param4" value="Failure!"/>
          <map:parameter name="param5" 
value="{session-attr:students.survey}"/>
        </map:call>
      </map:match>

The debug-params resource simply displays these parameter names and values.

I learned from the samples that you can pass an output parameter to the 
modular database actions.  What about the input?

Database Descriptor:

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <connection>cacsurvey</connection>
  
  <table name="students0506">
    <keys>
      <key name="sid" type="int"/>
    </keys>
    
    <values>
      <value name="survey" type="boolean"/>
    </values>
  </table>
  
  <table-set name="students">
    <table name="students0506"/>
  </table-set>
</root>

{session-attr:sid} and {session-attr:survey} were set from the initial 
authentication.  The survey field for this particular SID gets updated in the 
database using an Original Database Update action.  What I am trying to do is 
to use {session-attr:sid} to query the database record, retrieve the latest 
survey column value, and store it into {session-attr:survey}.  It doesn't 
matter whether I use Original or Modular actions but I would like to use 
actions as opposed to flowscript.

- Pasha

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message