C1 had a nested connection in its example (part of it is shown below), but
I've not tried it with C2. Depending on your needs, a more complex SQL
statement may work as well. The major factor is how much information from
department_table you want and if it is OK to repeat it with each member.
The following is from Cocoon 1.8.3-DEV sample file esql.xml:
<esql:execute-query>
<esql:query>select id,name from department_table</esql:query>
<esql:results>
<header>header info</header>
<esql:row-results>
<department>
<id><esql:get-int column="id"/></id>
<name><esql:get-string column="name"/></name>
<esql:connection>
<esql:driver>org.postgresql.Driver</esql:driver>
<esql:dburl>jdbc:postgresql://localhost/test</esql:dburl>
<esql:username>test</esql:username>
<esql:password>test</esql:password>
<esql:execute-query>
<esql:query>select name from user_table where department_id =
<esq
l:parameter type="int"><esql:get-int ancestor="1"
column="id"/></esql:parameter>
</esql:query>
<esql:results>
<esql:row-results>
<user><esql:get-string column="name"/></user>
</esql:row-results>
</esql:results>
Gary A. Clark
Systems Programmer
Software Services Group
JELD-WEN Information Systems
> -----Original Message-----
> From: Götz Botterweck [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, June 13, 2001 6:00 AM
> To: [EMAIL PROTECTED]
> Subject: C2: recommended method for accessing Database, esp. for
> nested queries?
>
> I'm already using the ESQL. Now I'd like to do nested queries. Somewhat
> like that
>
> QUERY
> retrieve departments
> FOR EACH department d
> retrieve all members of d
> /FOR EACH
> /QUERY
>
> I've seen the file ../docs/samples/sql/sql-page.xml with the
> <anchestor-value ... > tag. Is something similar possible with ESQL?
>
> Thanks for any hints.
> GB
>
> ---------------------------------------------------------------------
> 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]>
---------------------------------------------------------------------
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]>