New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow <set> to trim comma prefix #21

Closed
fengxx opened this Issue Mar 22, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@fengxx
Copy link

fengxx commented Mar 22, 2013

Propose to change set node to allow it trim comma prefix

public class SetSqlNode extends TrimSqlNode {

  public SetSqlNode(Configuration configuration,SqlNode contents) {
    super(configuration, contents, "SET", ",", null, ",");
  }

}

Reason:
It is natural for users migrated from ibatis to write code like this

UPDATE user
<set>
    <if test="name != null">
        name=#{name}
    </if>
    <if test="desc != null">
        ,desc=#{desc}
    </if>
</set>

Instead of

UPDATE user
<set>
    <if test="name != null">
        name=#{name},
    </if>
    <if test="desc != null">
        desc=#{desc}
    </if>
</set>

The added feature will not break anything, although may use some cpu cycles and slow down a bit.

@harawata harawata closed this in 95166a6 Oct 30, 2018

@harawata harawata self-assigned this Oct 30, 2018

@harawata harawata added this to the 3.5.0 milestone Oct 30, 2018

@harawata

This comment has been minimized.

Copy link
Member

harawata commented Oct 30, 2018

I have just committed the fix.
Thank you! :D

harawata added a commit that referenced this issue Oct 31, 2018

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