Skip to content

Conversation

@YSavanier
Copy link

Proposal :
Removed trailing space on sql fragments since this alter the sql code that the user typed in the sqlmap file preventing the use of static text to be used as value, label or whatever the user might need it for.

Ex :
<sql id="bar">${@com.packacge.whatever.the.heck.this.might.be.Globals@BAR_TEXT}</sql> <select id="exemple"> select bar "bar end with <include refid="bar"/>" from foo where bar = '%<include refid="bar"/>' </select>

This will fail since the space added at the sql fragment's end will corrupt the where filter (as well as the column title). This trailing space just alter the code the user did write and thus should be removed.

Cheers.

Proposal : Removed trailing space on sql fragments since this alter the sql code that the user typed in the sqlmap file preventing the use of static text to be used as value, label or whatever the user might need it for. Ex : <sql id="bar">${@com.packacge.whatever.the.heck.this.might.be.like.utils.Globals@BAR_TEXT}</sql> <select id="exemple"> select bar "bar ending with <include refid="bar"/>" from foo where bar = '%<include refid="bar"/>' </select> This will fail since the space added at the sql fragment's end will corrupt the where filter (as well as the column title). This trailing space just alter the code the user did write and thus should be removed. Cheers.
@YSavanier YSavanier closed this Apr 2, 2014
@YSavanier YSavanier deleted the patch-3 branch April 2, 2014 11:36
@emacarron
Copy link
Member

Hi. I am afraid we cannot change that or we may break existing code.

@YSavanier
Copy link
Author

Hi :)

Sorry, i saw the travis test compilation failure and agree this would be too much burden since this code is also used by other parts that need the trailing space...

I discovered I could use OGNL to store data then use it directly as text or bind variables which is far more flexible and powerfull than my first approach using sql fragment element.

Ex :
${(FOO=@com.util.Globals@BAR)?"":""} select '${FOO}' as "this is ${FOO}" from dual
or
<bind name="FOO" value="@com.util.Globals@BAR"> select 1 from dual where 'foo' = #{FOO}

So please ignore my request thank you ^^

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants