Brent,
what if there is some special character inside the string, for example
some " or ',
if I just wrap them up as a string, error might happens during the query,
you know mysql might throw an error if your query is
select user_id from users where user_name="""""";
----- Original Message -----
From: "Brent Johnson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 29, 2004 8:18 PM
Subject: Re: [esql] xsp:logic doesn't work inside <esql:query>?
> Yes - try running your loop outside the esql tags (as I suggested
> before). Build your SQL statement as a String then just do:
>
> <esql:query><xsp:expr>mySqlStatement</xsp:expr></esql:query>
>
> Just a suggestion.
>
> - Brent
>
> On Thu, 29 Jul 2004 21:03:04 -0700, Christina <[EMAIL PROTECTED]>
wrote:
> > Hi, Jeff,
> > that is a good idea. But what if I have another "for" loop inside of
the
> > "if"?
> > What I really want to do is take a list from the request attribute
and
> > query every entry in that list.
> > also i don't know the length of the list beforehand. so I need an
"if"
> > for the first entry (encase that is a list with zero length) and a "for"
> > loop for every one else.
> > Any idea how to do it?
> > Thanks!
> >
> >
> > ----- Original Message -----
> > From: "Jeff Jones" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, July 29, 2004 2:20 PM
> > Subject: Re: [esql] xsp:logic doesn't work inside <esql:query>?
> >
> > >
> > > Christina,
> > >
> > > I can't explain why that doesn't work, but I've never tried it. You
could
> > do it
> > > this way, though:
> > >
> > > <esql:query>
> > > SELECT foo FROM bar
> > > WHERE baz = <esql:parameter><xsp:expr>( (test) ? "quux" :
> > blort.someMethod()
> > > )</xsp:expr></esql:parameter>
> > > </esql:query>
> > >
> > > In other words, replace the "if (test)" statement with the equivalent
> > "(test) ?
> > > expr1 : expr2" expression. <xsp:expr> should work here, even though
> > <xsp:logic>
> > > doesn't.
> > >
> > > </Jeff>
> > >
> > >
> > >
> > >
> > > "Christina"
> > > <[EMAIL PROTECTED] To:
> > <[EMAIL PROTECTED]>
> > > il.com> cc:
> > > Subject: [esql]
xsp:logic
> > doesn't work inside <esql:query>?
> > > 07/29/2004 07:33
> > > PM
> > > Please respond to
> > > users
> > >
> > >
> > >
> > >
> > >
> > >
> > > I tried to use if () inside <esql:query> like this:
> > > ....
> > > <esql:query>
> > > <xsp:logic>
> > > if (true) {
> > > <esql:parameter>...</esql:parameter>
> > > }
> > > </xsp:logic>
> > > </esql:query>
> > > ....
> > > but every time there is error message on this "if", it is ok if I
delete
> > > everything before and after the nested <xsp:logic> tag.
> > > So <xsp:logic> cannot work inside of <esql:query>? or I did something
> > wrong?
> > > Thanks!
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]