cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From SunnyDay <sunny...@rainyday.de>
Subject Re: [C2] esql: using query results in another query
Date Wed, 16 Jan 2002 16:02:51 GMT
<esql:get-string column="id" ancestor="1"/>

should work

CU
   Harald


fred.tsang@widelearning.com wrote:

> I was wondering if anyone has used one esql result field in another query.
> What I thought it should look like is:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsp:page
>    language="java"
>    xmlns:xsp="http://apache.org/xsp"
>    xmlns:esql="http://apache.org/cocoon/SQL/v2"
> 
>   <page>
>     <content>
>       <esql:connection>
>         <esql:pool>pooledConnect</esql:pool>
>         <department>
>         <esql:execute-query>
>           <esql:query>
>             select id from department_table
>           </esql:query>
>           <!-- note embedded query here -->
>           <esql:execute-query>
>             <esq:query>
>               select id,name 
>               from employee_table 
>               where department_id = <ancestor-value esql:name="id"
> esql:level="1"/>
>             </esql:query>
>             <esql:results>
>               <esql:row-results>
>                 <employee>
>                   <employeeId><esql:get-string column="id"/></employeeId>
>                   <employeeName><esql:get-string
> column="name"/></employeeName>
>                 </employee>
>               </esql:row-results>
>             </esql:results>
>           </esql:execute-query>
>         </esql:execute-query>
>         </department>
>       </esql:connection>
>     </content>
>   </page>
> </xsp:page>
> 
> I would expect somthing like this to output:
> 
> <department>
>   <employeeId>1</employeeId>
>   <employeeName>Joe</employeeName>
>   <employeeId>2</employeeId>
>   <employeeName>John</employeeName>
>   <employeeId>3</employeeId>
>   <employeeName>Jack</employeeName>
> </department>
> <department>
>   <employeeId>4</employeeId>
>   <employeeName>Mary</employeeName>
>   <employeeId>5</employeeId>
>   <employeeName>Bob</employeeName>
>   <employeeId>6</employeeId>
>   <employeeName>Paul</employeeName>
> </department>
> 
> I'd also like to identify the department id with an attribute or an
> <id></id> field, but I'm not sure how.  If anyone can guide me in this, I
> would really appreciate it.  The example in docs/samples/sql/sql-page.xml is
> out of date I think, and the esql example is too simple.
> 
> Thanks in advance,
> Fred
> 
> 
> 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: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> 
> 



---------------------------------------------------------------------
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message