You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ugo Cei <u....@cbim.it> on 2000/07/11 09:05:03 UTC

XSP SQL Taglib: using bind variables

It seems to me that the XSP SQL Taglib would need to support bind
variables, in order to perform queries with variable parameters, without
resorting to concatenation, which inevitably gives quoting problems.

This is what I am presently doing in order to specify a parametrized
query:

        <sql:query>
          select column_list from table
          where column_name =
            <xsp:expr>
              "'" + request.getParameter("param") + "'"
            </xsp:expr>
        </sql:query>

And this is what I would like to do (just a rough outline):

      <sql:execute-query>
        <sql:variable type="string">
          <xsp:expr>
            request.getParameter("param")
          </xsp:expr>
        </sql:variable
        <sql:query>
          select column_list from table where column_name = ?
        </sql:query>
      </sql:execute-query>

Before I start reinventing the wheel, has anybody given any thought
about this, or even implemented something?

--
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: u.cei@cbim.it

Re: XSP SQL Taglib: using bind variables

Posted by Ugo Cei <u....@cbim.it>.
Donald Ball wrote:
 
> No, but that's probably a good approach. No one who was interested in this
> had ever been able to suggest a good syntax for declaring the types
> and values of the variables. I'd be happy to take a patch to the sql
> logicsheet that operated on this fragment. Are you up for that or should I
> put it in my queue (which is quite long and messy, but finite)?

Sorry for being so late in replying. It seems like my queue is infinite,
or at least it fills faster than it empties :(. I'm still trying to grok
the big picture with Cocoon, so I don't think I'm up for that, at least
for the moment.

--
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: u.cei@cbim.it

Re: XSP SQL Taglib: using bind variables

Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 11 Jul 2000, Ugo Cei wrote:

> It seems to me that the XSP SQL Taglib would need to support bind
> variables, in order to perform queries with variable parameters, without
> resorting to concatenation, which inevitably gives quoting problems.
> 
> And this is what I would like to do (just a rough outline):
> 
>       <sql:execute-query>
>         <sql:variable type="string">
>           <xsp:expr>
>             request.getParameter("param")
>           </xsp:expr>
>         </sql:variable
>         <sql:query>
>           select column_list from table where column_name = ?
>         </sql:query>
>       </sql:execute-query>
> 
> Before I start reinventing the wheel, has anybody given any thought
> about this, or even implemented something?

No, but that's probably a good approach. No one who was interested in this
had ever been able to suggest a good syntax for declaring the types 
and values of the variables. I'd be happy to take a patch to the sql
logicsheet that operated on this fragment. Are you up for that or should I
put it in my queue (which is quite long and messy, but finite)?

- donald