You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Otmar Vobejda <ot...@hcwerk.cz> on 2003/11/05 10:47:05 UTC

Recursive reading from database

Hi, i'm a beginner in the Cocoon domain and first problem, what I'd like 
to solve, is recursive reading from database. For example you have a 
table test(id int, parent int, name varchar), where parent attribute 
points to id attribute of parent rows and you need to read all the rows 
to the tree.

for example something like this (excuse the syntax :):

// recursive function
public void readData (int parent) {
  select id, name from test where parent= $parent;
  for each result {
      print ($name);
      readData($id);
  }

// start recursion:
readData(null);

But how to write in XSP, when methods need to be in root <xsp:page> 
element and esql tags must be inside top user element (or how it is 
termed).

Thank a lot for each your outline!

osup



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


RE: Recursive reading from database

Posted by Nicolas Toper <nt...@jouve.fr>.
Why don't you use the SQL Transformer combined with the FilterTransformer?
It might be easier?

-----Message d'origine-----
De : Otmar Vobejda [mailto:otmar@hcwerk.cz]
Envoyé : mercredi 5 novembre 2003 10:47
A : users@cocoon.apache.org
Objet : Recursive reading from database


Hi, i'm a beginner in the Cocoon domain and first problem, what I'd like
to solve, is recursive reading from database. For example you have a
table test(id int, parent int, name varchar), where parent attribute
points to id attribute of parent rows and you need to read all the rows
to the tree.

for example something like this (excuse the syntax :):

// recursive function
public void readData (int parent) {
  select id, name from test where parent= $parent;
  for each result {
      print ($name);
      readData($id);
  }

// start recursion:
readData(null);

But how to write in XSP, when methods need to be in root <xsp:page>
element and esql tags must be inside top user element (or how it is
termed).

Thank a lot for each your outline!

osup



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



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