ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: How to get ## into a SQL statement
Date Tue, 12 Jul 2005 16:47:44 GMT
Yes, it is parsed twice: The $$ stuff is processed first, then the ##
stuff is processed.

Changing that behavior would likely impact working applications.

Larry


On 7/12/05, Brice Ruth <bdruth@gmail.com> wrote:
> It isn't valid to pass something in with $subs$ that contains #value#,
> though ... is it? That's not gonna get parsed twice, is it? Or is it an
> order-of-execution problem? That's probably it ... iBatis has to do the $$
> substitutions before it creates the prepared statement ... so that's where
> its getting hung up, I bet.
>  
>  If all the #value-or-parameter# strings were converted to ? before the
> $subs$ substitutions were done, that wouldn't be a problem though, right?
> Would that detrimentally affect the dynamic SQL logic? The way I see it,
> #value# and $subs$ both need to be 'processed' before a PreparedStatement is
> created. In this case, the order is causing this symptom.
>  
>  Of course, this is all guess-work, as I don't have the code in front of me
> ;)
>  
>  Brice
> 
> 2005/7/12, Larry Meadors <larry.meadors@gmail.com>:
> > Nope, that is not a bug IMO.
> > 
> > If you want to construct dynamic SQL using $substitution$, I think
> > that should work as it does.
> > 
> > Larry
> > 
> > 
> > On 7/12/05, Brice Ruth <bdruth@gmail.com > wrote:
> > > So, if you include the '##' as part of the paramTempTable variable when
> its
> > > passed into iBatis, you get an error? That seems like a bug to me. What
> do
> > > you think, Larry? Clinton? The '#' and '$' symbols are reserved in the 
> > > SqlMap file itself, but passing in variables that include this should be
> > > kosher.
> > >
> > >  Brice
> > >
> > > 2005/7/12, Barnett, Brian W. <brian.barnett@pearson.com >:
> > > > I ended up doing this and it worked fine:
> > > >
> > > > SELECT *
> > > > FROM ####$paramTempTable$
> > > >
> > > > If I included the ## as part of paramTempTable, I got an error. I
> can't 
> > > > remember what the error was. Seems like it was some obscure error.
> > > Something
> > > > about "@P0" or something.
> > > >
> > > > Thanks all for your suggestions.
> > > >
> > > > -----Original Message-----
> > > > From: Larry Meadors [mailto:larry.meadors@gmail.com]
> > > > Sent: Tuesday, July 12, 2005 8:59 AM
> > > > To: user-java@ibatis.apache.org; Brice Ruth
> > > > Subject: Re: How to get ## into a SQL statement
> > > >
> > > >
> > > > The remapResults attribute should not be required - the table name
> > > changes, 
> > > > but the column list does not.
> > > >
> > > > Larry
> > > >
> > > > On 7/12/05, Brice Ruth <bdruth@gmail.com> wrote:
> > > > > I think your problem is that you need to use $paramTempTable$ to

> > > > > parameterize your table. You'll probably also need to set
> > > > > remapResults="true" in your mapped statement definition.
> > > >
> > > >
> > >
> ****************************************************************************
> > > > This email may contain confidential material.
> > > > If you were not an intended recipient,
> > > > Please notify the sender and delete all copies.
> > > > We may monitor email to and from our network. 
> > > >
> > >
> ****************************************************************************
> > > >
> > >
> > >
> > >
> > > --
> > > Brice Ruth
> > > Software Engineer, Madison WI
> > 
>  
> 
> 
> -- 
> Brice Ruth
> Software Engineer, Madison WI

Mime
View raw message