You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Matt Sabourin <Ma...@sdrc.com> on 2001/06/20 15:16:49 UTC

ESQL, multiple queries?

I'm using Cocoon 1.8.2, Apache 1.3, Tomcat 3.2.1, MySQL 3.23.38, Solaris
2.6.

I have created multiple tables within the DB to represent employee,
phone, pager and other objects.  They are connected with what would 
be foreign keys if I wasn't using MySQL.  I would like to create ESQL
queries to load each type of object ( an employee query, a phone query,
etc ).  The queries for objects like the phone and pager would need to
have an ID passed in.  I want separate queries to keep the code cleaner,
and to make the stylesheet reusable.

The problem I'm having is this:  I load the employee objects up fine,
and each employee object contains the ID ( foreign key ) for a phone
and pager object.  I would like to do something like: 

<xsl:call-template name="phone">
  <xsl:with-param name="ID">
    <esql:get-int column="PhoneID"/>  
  </xsl:with-param>
</xsl:call-template>

The "phone" template would then use the ID param in another SQL query
that would load the phone information.

I can not get this to work when I include both the employee and the
phone templates in one XSP.  The ID param does not get a value in the
phone template.  I know that values are returned ( verified by not making
a template call and just looking at what is output from the employee
template ).  I can pass in a static value, and the phone query works.  I
thought the problem might have something to do with the way XSP works, so 
I tried moving the phone template into a second XSP, before I saw that
you can not chain XSP's...

SO, does anyone have *any* suggestions?  I could do a *massive* query/join,
but that makes the code very ugly and inflexible.  I could combine all my
database tables into one, but that's even worse than one huge SQL join.  I
could probably get things to work with nested ESQL queries, but that is also
somewhat inflexible.  


tnx
-m




======================================================================
Matt Sabourin				Voice: 313.845.2529
Systems Engineer			Fax:   313.317.6060
Structural Dynamics Research Corp. 	Pager: 313.201.7741
1555 Fairlane Dr., Suite 300		Email: Matt.Sabourin@sdrc.com
Allen Park, MI 48101			

AlphaPage: matt.sabourin@myairmail.com
AlphaPage: http://www.myairmail.com
======================================================================


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