Rebecca,

It might take some time to prove it, but I'm pretty sure you can't do what
you are trying to do with ESQL.  I've gotten pretty deep into the ESQL
logicsheet, and it looks for specific tags in specific relationship to
other tags, e.g., it will look for the esql:parameter tags as children of
an esql:query tag.  Since the logicsheet knows nothing of your java logic,
it will generate parameter setting code for each esql:parameter tag,
regardless of whether you manage to put logic around the tag to switch it
on or off in the query itself.  So whatever you do, you will get errors if
you try to have a dynamic number of parameters in a single esql block,
because the parameter setting code will not match the query.  (The
existence of the parameter tag creates java in more than one place, but
your xsp:logic conditional java code will only be copied into the query
area - assuming the logicsheet will even honor those blocks.)

So, here are your choices as I see them:
1.  Abandon parameter binding, and just build the SQL string dynamically
(which is what we do with this situation)
2. Create a separate ESQL block for every possible combination of
parameters, then choose which ESQL block to run via java logic
3. Extend/modify the ESQL logicsheet to meet your needs; you can get the
esql.xsl out of your cocoon.jar file, modify it, then modify cocoon.xconf
to point to your modified logicsheet
4. Don't use ESQL (would SQL transformer work for you?)

Sorry I don't have an easy solution for you.

-Christopher




                                                                                       
                        
                      R Hunt                                                           
                        
                      <[EMAIL PROTECTED]        To:       [EMAIL PROTECTED]            
                   
                      .edu>                    cc:                                     
                        
                                               Subject:  binding params in dynamic 
queries in ESQL             
                      03/05/2004 11:27                                                 
                        
                      AM                                                               
                        
                      Please respond to                                                
                        
                      users                                                            
                        
                                                                                       
                        
                                                                                       
                        




Thanks in advance for any help on this.

I would like to build a SQL statement dynamically based on whether not not
certain parameters have been sent, but also use bound parameters in my SQL
query.
I seem to be having troubles getting the parsing  quite right.

To give a better idea of what I'm trying to do, I've included my code from
my first attempt:

<snip>

Thanks in advance,
Rebecca



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to