You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peretta Simone <s....@cbim.it> on 2000/10/18 12:57:14 UTC

ESQL and XSP:EXPR problem

Hi I've some problem in my esql query:


<xsp:page language="java"
   xmlns:esql="http://apache.org/cocoon/SQL/v2"
   xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>


<page>

<xsp:logic>
String cod="'"+"280"+"'";
</xsp:logic>

<esql:execute-query>
<esql:use-connection>kayak</esql:use-connection>
<esql:query>select name from structure where ID=<xsp:expr>cod</xsp:expr>
</esql:query>
<esql:results>
    <name><esql:get-string column="name"/></name>
</esql:results>
</esql:execute-query>
            

</page>
</xsp:page>


cocoon return me this error message:
"Undefined variable: cod"
But i've just tried this query with SQL tag and everything went OK why
Thanks


Re: ESQL and XSP:EXPR problem

Posted by OD <od...@feersumendjinns.com>.
Ack! My apologies to the list for the misinformation.
Time to go fix some pages :(

Corey

----- Original Message -----
From: Donald Ball <ba...@webslingerZ.com>
To: <co...@xml.apache.org>
Sent: Wednesday, October 18, 2000 7:33 PM
Subject: Re: ESQL and XSP:EXPR problem


> On Wed, 18 Oct 2000, OD wrote:
>
> > Hi, this a problem with your variable scope. You have at least 2
options.
> >
> > option1 (must have a recent version of esql)
> > Change <esql:execute-query> to <esql:execute-query inner-method="no">
>
> that's the proper option, at least until we deal with the 64k method
> limit.
>
> > option2 (prefered) Read the xsp docs again, study your compiled code
> > in the repository Add a class level <xsp:logic> block:
>
> _NOT_ preferred. this is not thead safe! if the cod variable depends on
> request-time conditions, multiple threads could overwrite each other's cod
> variable.
>
> - donald
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: ESQL and XSP:EXPR problem

Posted by Donald Ball <ba...@webslingerZ.com>.
On Wed, 18 Oct 2000, OD wrote:

> Hi, this a problem with your variable scope. You have at least 2 options.
> 
> option1 (must have a recent version of esql)
> Change <esql:execute-query> to <esql:execute-query inner-method="no">

that's the proper option, at least until we deal with the 64k method
limit.

> option2 (prefered) Read the xsp docs again, study your compiled code
> in the repository Add a class level <xsp:logic> block:

_NOT_ preferred. this is not thead safe! if the cod variable depends on
request-time conditions, multiple threads could overwrite each other's cod
variable.

- donald


Re: ESQL and XSP:EXPR problem

Posted by OD <od...@feersumendjinns.com>.
Hi, this a problem with your variable scope. You have at least 2 options.

option1 (must have a recent version of esql)
Change <esql:execute-query> to <esql:execute-query inner-method="no">

option2 (prefered) Read the xsp docs again, study your compiled code in the repository
Add a class level <xsp:logic> block:

<xsp:page language="java"
   xmlns:esql="http://apache.org/cocoon/SQL/v2"
   xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>

<xsp:logic>
<!-- Class level logic !-->
String cod;
</xsp:logic>

<page>

<xsp:logic>
<!-- members defined here are only available in the populateDocument() method of the compiled page !-->
cod="'"+"280"+"'";
</xsp:logic>

<esql:execute-query>
<esql:use-connection>kayak</esql:use-connection>
<esql:query>select name from structure where ID=<xsp:expr>cod</xsp:expr>
</esql:query>
<esql:results>
    <name><esql:get-string column="name"/></name>
</esql:results>
</esql:execute-query>
            

</page>
</xsp:page>


Corey O'Donovan

----- Original Message ----- 
  From: Peretta Simone 
  To: cocoon-users@xml.apache.org 
  Sent: Wednesday, October 18, 2000 11:57 AM
  Subject: ESQL and XSP:EXPR problem


  Hi I've some problem in my esql query:


  <xsp:page language="java"
     xmlns:esql="http://apache.org/cocoon/SQL/v2"
     xmlns:xsp="http://www.apache.org/1999/XSP/Core"
  >


  <page>

  <xsp:logic>
  String cod="'"+"280"+"'";
  </xsp:logic>

  <esql:execute-query>
  <esql:use-connection>kayak</esql:use-connection>
  <esql:query>select name from structure where ID=<xsp:expr>cod</xsp:expr>
  </esql:query>
  <esql:results>
      <name><esql:get-string column="name"/></name>
  </esql:results>
  </esql:execute-query>
              

  </page>
  </xsp:page>


  cocoon return me this error message:
  "Undefined variable: cod"
  But i've just tried this query with SQL tag and everything went OK why
  Thanks