You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christian Parpart <tr...@gmx.de> on 2001/01/11 00:32:13 UTC

mySQL says esql:query is empty

Hi,

What's wrong?

I've the problem, that my query is ignored, when I try
to generate it dynamically - but I need to do.

I've added the following to xsp:page
[----------------------------
  <xsp:structure>
    <xsp:add-std-param>Stack _esql_connections</xsp:add-std-param>
    <xsp:add-std-param>EsqlConnection _esql_connection</xsp:add-std-param>
    <xsp:add-std-param>Stack _esql_queries</xsp:add-std-param>
    <xsp:add-std-param>EsqlQuery _esql_query</xsp:add-std-param>
    <xsp:add-std-param>SQLException _esql_exception</xsp:add-std-param>
    <xsp:add-std-param>StringWriter
_esql_exception_writer</xsp:add-std-param>
  </xsp:structure>
-----------------------------]

Then I've implemented the following function to xsp:page/xsp:logic
[----------------------------
  void showHeaders(
      <xsp:get-std-param/>,
      String From, String Limit,
      String Comments, String ReadMore) throws Exception {

    <esql:execute-query>
      <esql:query>
        <xsp:expr>
          "SELECT Concat(DayOfMonth(Date, '.', Month(Date), '.', Year(Date))
as PrintDate, Title, Text" +
          " FROM " + From +
          " WHERE ParentID=0" +
          " ORDER BY date DESC"
        </xsp:expr>
        <xsp:logic>
          if (Limit != null &amp;&amp; Limit.length() > 0) {
          <!-- doesn't work
            <xsp:expr>"LIMIT " + Limit</xsp:expr> -->
          }
        </xsp:logic>
      </esql:query>
      <esql:results>
        <news>
          <esql:row-results>
            <item>
              <xsp:attribute name="date"><esql:get-string
column="PrintDate"/></xsp:attribute>
              <xsp:attribute
name="href"><xsp:expr>ReadMore</xsp:expr></xsp:attribute>
              <esql:get-string column="title"/>
            </item>
          </esql:row-results>
        </news>
      </esql:results>
    </esql:execute-query>
  }
-----------------------------]

This is my applying template:
[---------------------------------------
  <xsl:template match="news:headers">
    <xsl:variable name="from"><xsl:call-template
name="get-nested-content"><xsl:with-param name="content"
select="news:from"/></xsl:call-template></xsl:variable>
    <xsl:variable name="limit"><xsl:call-template
name="get-nested-string"><xsl:with-param name="content"
select="news:limit"/></xsl:call-template></xsl:variable>
    <xsl:variable name="comments"><xsl:call-template
name="get-nested-string"><xsl:with-param name="content"
select="news:comments"/></xsl:call-template></xsl:variable>
    <xsl:variable name="readMore"><xsl:call-template
name="get-nested-string"><xsl:with-param name="content"
select="news:read-more"/></xsl:call-template></xsl:variable>

    <xsl:variable name="driver"><xsl:call-template
name="get-nested-content"><xsl:with-param name="content"
select="news:driver"/></xsl:call-template></xsl:variable>
    <xsl:variable name="dburl"><xsl:call-template
name="get-nested-content"><xsl:with-param name="content"
select="news:dburl"/></xsl:call-template></xsl:variable>
    <xsl:variable name="username"><xsl:call-template
name="get-nested-content"><xsl:with-param name="content"
select="news:username"/></xsl:call-template></xsl:variable>
    <xsl:variable name="password"><xsl:call-template
name="get-nested-content"><xsl:with-param name="content"
select="news:password"/></xsl:call-template></xsl:variable>

    <esql:connection>
      <esql:driver><xsl:value-of select="$driver"/></esql:driver>
      <esql:dburl><xsl:value-of select="$dburl"/></esql:dburl>
      <esql:username><xsl:value-of select="$username"/></esql:username>
      <esql:password><xsl:value-of select="$password"/></esql:password>
      <xsp:logic>
        showHeaders(
          <xsp:put-std-param/>,
          new String("<xsl:value-of select="$from"/>"),
          new String(<xsl:value-of select="$limit"/>),
          new String(<xsl:value-of select="$comments"/>),
          new String(<xsl:value-of select="$readMore"/>)
        );
      </xsp:logic>
    </esql:connection>
  </xsl:template>
---------------------------------------]

Thanks,
Christian Parpart
SurakWare
cparpart@surakware.com
http://www.surakware.com

> -----Ursprüngliche Nachricht-----
> Von: Robin Green [mailto:greenrd@hotmail.com]
> Gesendet: Mittwoch, 10. Januar 2001 22:42
> An: cparpart@surakware.com
> Cc: cocoon-users@xml.apache.org
> Betreff: Re: Undefined variable: xspParentNode
>
>
> T. Anthony explains how to solve exactly this problem in his multiple
> reposted messages entitled:
>
> Re: News site with XSP and SQL. (fwd)[C1][C2] variables in XSP
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>


Re: mySQL says esql:query is empty

Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 11 Jan 2001, Christian Parpart wrote:

> Hi,
>
> What's wrong?
>
> I've the problem, that my query is ignored, when I try
> to generate it dynamically - but I need to do.
>
> I've added the following to xsp:page
> [----------------------------
>   <xsp:structure>
>     <xsp:add-std-param>Stack _esql_connections</xsp:add-std-param>
>     <xsp:add-std-param>EsqlConnection _esql_connection</xsp:add-std-param>
>     <xsp:add-std-param>Stack _esql_queries</xsp:add-std-param>
>     <xsp:add-std-param>EsqlQuery _esql_query</xsp:add-std-param>
>     <xsp:add-std-param>SQLException _esql_exception</xsp:add-std-param>
>     <xsp:add-std-param>StringWriter
> _esql_exception_writer</xsp:add-std-param>
>   </xsp:structure>

what is the xsp:add-std-param element? it's not a valid xsp element.

- donald