cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scherler, Thorsten" <Thorsten.Scher...@weidmueller.de>
Subject [Summary] nested queries with esql
Date Wed, 12 Mar 2003 15:23:11 GMT
Hello group,
hello Christian Haul, hello Tim Myers, hello Leo Leonid,

here is my small summary (I will put it in the wiki ;-)).

problem:
I am using a RDBMS. I have two queries where the second query should use the result of the
first.

example (working one): 
my.xsp:
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp" xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp-request="http://apache.org/xsp/request/2.0">
<dataset>
<esql:connection>
<esql:pool>OSTMDB</esql:pool>
<!--First query-->
<esql:execute-query>
<esql:query>
select ap_id as id from sales 
</esql:query>
<esql:results>
<esql:row-results>
<data>
<ep1>
<esql:get-int column="id"/>
</ep1>
<!--Second query which should dynamic -->
<aps>
<esql:execute-query>
<esql:query>
 select * from ap_tab where ap_id =1
</esql:query>
<esql:results>
<esql:row-results>
<ap>
<esql:get-columns/>
</ap>
</esql:row-results>
</esql:results>
<esql:no-results>
<no-results/>
</esql:no-results>
<esql:error-results/>
</esql:execute-query>
</aps>
</data>
</esql:row-results>
</esql:results>
<esql:no-results/>
<esql:error-results/>
</esql:execute-query>
</esql:connection>
</dataset>
</xsp:page>

Suggestions from the list:
a) Christian wrote (Mail: Multiple ancestors):
select * from ap_tab where ap_id =	<esql:parameter type="int"><esql:get-int column="id"
ancestor="1"/></esql:parameter>
Status => not working! I don't receive any error messages. It is just working without any
result (besides CPU-usage 100%). I tried with 2 different db (big and small) but neither were
working :( -> thanks for the support, anyway. :)
=> modifying the query like:
<esql:parameter><esql:get-int column="id" ancestor="1"/></esql:parameter>
will not result in an error but neither I receive the data of the contact person!

b)Tim wrote (Mail: Re: esql nested queries):
"You need a <xsp:logic>int ap_id = <esql:get-int column="id"/> before the inner
query begins and then use <xsp:expr>ap_id</xsp:expr> in the inner query to recall
it."
=> That is working fine with the small and big db!

So the final my.xsp looks like that:
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp" xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp-request="http://apache.org/xsp/request/2.0">

<dataset>
<esql:connection>
<esql:pool>INSTA</esql:pool>
<!--note-->
<esql:execute-query>
<esql:query>
         select ap_id as id  from xml_verkauf 
         </esql:query>
<esql:results>
<esql:row-results><xsp:logic>int xid =<esql:get-int column="id"/>;</xsp:logic>
<data>
<ep1>
<xsp:expr>xid</xsp:expr>
</ep1>
<!--note-->
<aps>
<esql:execute-query>
<esql:query>
                  select * from ap_tab where ap_id =<xsp:expr>xid</xsp:expr></esql:query>
<esql:results>
<esql:row-results>
<ap>
<esql:get-columns/>
</ap>
</esql:row-results>
</esql:results>
<esql:no-results>
<no-results/>
</esql:no-results>
<esql:error-results/>
</esql:execute-query>
</aps>
</data>
</esql:row-results>
</esql:results>
<esql:no-results/>
<esql:error-results/>
</esql:execute-query>
</esql:connection>
</dataset>
</xsp:page>

Thank you for the hints you gave me! Tim, thanks for actually SOLVING MY problem.

King regards
Thorsten

---------------------------------------------------------------------
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