I found different ways for SQL in cocoon. On the one hand there is <esql:.../>, on the other <sql:...>. So consider this a work in progress – Scherler

As is the case with most things in cocoon, there are a variety of ways to accomplish the same task. In addition to the ESQL logicsheet and the SQL transformer mentioned aboved, there are also a variety of SQL actions. – LarryLansing


Agenda:BR

  • Difference between sql and esql => first page (this is the first page)
  • example1 sql / esql

beginner example of both approaches with the same result => second page

  • example2 sql / esql

Parameter example of both approaches with the same result => third page

  • example3 esql (nested example) => fourth page
  • example4 esql (nested example + <xsp:logic>) => fifth page


SQLdifferenceESQL:BR The main difference that I see is that <sql:.../> is based on a transformer and <esql:...> on a generator.

second page:

simple pipline

"Select id, department_id, name from employee"

sql-transform and esql-generation.

...

third page:

simple pipline

"Select id, department_id, name from employee Where id=?"

sql-transform and a esql-generation.

Introduction to <esql:parameter/> and <xsl:param/>.

...

fourth page:

nested example with esql - 2 approaches:

a) select * from ap_tab where ap_id = <esql:parameter type="int"><esql:get-int column="id" ancestor="1"/></esql:parameter>

b) 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.

<query1>

select ap_id as id from sales <query2>

select * from ap_tab where ap_id =<query1-result>id<query1-result>

</query2>

</query1>

...

fifth page:

http://wiki.cocoondev.org/Wiki.jsp?page=XSPTransformCustomDateBR

I will work on a regular basis on it and everybody is welcome to edit the page!

  • No labels