You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <dh...@csir.co.za> on 2005/10/10 16:09:11 UTC

Groovy variables inside an SQL "loop"

I was wondering if anyone could help with
a seemingly trivial problem:

When I have this code:

pageFilter = '*';
linker = '*';
myParamValue = request.getParameter(myParam);
if ( myParamValue == "true" ) {
 pageFilter  = pageFilter + linker;
 linker = '';
}

it work just fine, but I soon as I wrap this in an
SQL "loop":

sql.eachRow(pageSQL ) { rows | 
  if ( myParamValue == "true" ) {
   pageFilter  = pageFilter + linker;
   linker = '';
  }
}

It fails - both on the  "pageFilter  = pageFilter "
and the " linker = '';" step (tested both independantly)
part - for example, having:

sql.eachRow(pageSQL ) { rows | 
  if ( myParamValue == "true" ) {
   foo  = pageFilter + linker;
   bar = '';
  }
}

works just fine as well- but is not what I want to 
accomplish - why does Groovy not permit variables
to reference/change themselves inside the SQL, and 
how does one then accomplish this?

Thanks
Derek


-- 
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
 
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 
 
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html 
 
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
HelpDesk@csir.co.za.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


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