Here is an example I worked out (with help). Don't know if this works for 2
embedded queries:

  <page>
    <content>
      <esql:connection>
        <esql:pool>pooledConnect</esql:pool>
        <esql:execute-query>
          <esql:query>
            select dept from department_table
          </esql:query>
          <esql:results>
            <esql:row-results>
              <list>
                <dept>
                <esql:get-string column="dept"/>
                </dept>
                <esql:execute-query>
                  <esql:query>
                    select id,name 
                    from employee_table 
                    where department_id = <esql:get-string column="dept"
ancestor="1"/>
                  </esql:query>
                  <esql:results>
                    <esql:row-results>
                      <employee>
                        <name><esql:get-string column="name"/></name>
                      </employee>
                    </esql:row-results>
                  </esql:results>
                  <esql:no-results>
                    <p>Sorry, no results 2!</p>
                  </esql:no-results>
                </esql:execute-query>
              </list>
            </esql:row-results>
          </esql:results>
          <esql:no-results>
            <p>Sorry, no results 1!</p>
          </esql:no-results>
        </esql:execute-query>
      </esql:connection>
    </content>
  </page>

hope this helps.
Fred

-----Original Message-----
From: Olivier Rossel [mailto:[EMAIL PROTECTED]]
Sent: 14 February 2002 14:37
To: [EMAIL PROTECTED]
Subject: ESQL doc.


I read the archives of the mailing-list about ESQL and nested queries.
I read an interesting thing about "ancestor" in the declaration of inner 
requests.
But I can find no documentation at all, about that point.

Anyone has a link?
Any docs has been updated in addition to the page available at:
http://xml.apache.org/cocoon/userdocs/xsp/esql.html ?

My problem is to have something like:

<query1> select foobar, foo, bar from table1;
for each foobar:  { 
   <query2> select * from table2 where field1=<current-value-of foobar>;
    for each barfoo (selected by the previous query, inside the '*'): {
        <query3> select * from table3 where field1=<current-value-of barfoo;
    }
    <get-columns-of query2>
    <get-columns-foo-of query1>
    <get-columns-bar-of query1>
}

I do not plan to use a single complicated SQL request in order to have a 
flat XML
output.



Legal Disclaimer 

This message contains confidential information and is intended only for
the individual named.  If you are not the named addressee you should not
disseminate, distribute or copy this e-mail.  Please notify the sender
immediately by e-mail if you have received this e-mail by mistake and delete
this e-mail from your system.
mail transmission cannot be guaranteed to be secure or error-free as
information could be intercepted, corrupted, lost, destroyed, arrive late or
incomplete, or contain viruses.  The sender therefore does not accept
liability for any errors or omissions in the contents of this message that
arise as a result of e-mail transmission.  If verification is required
please request a hard-copy version.  This message is provided for
informational purposes only.
our website at: http://www.widelearning.com

Wide Learning is a trading name of Wide Multimedia Ltd Registered office:
33-41 Dallington Street, London EC1V 0BB
Company number: 3339664 VAT number: 690 8399 83


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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

Reply via email to