shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

CaseExpressionContext#simpleExpr may throw NullPointException (version: 4.1.0)(MYSQL)

Open azraelee opened this issue 6 years ago • 2 comments

项目依赖版本: mybatis-spring-boot-starter version 1.2.0 spring boot verson 1.4.3.RELEASE sharding-sphere version 4.1.0 mysql-connector-java verson 5.1.46

这个是我的项目sql:

update xxx_table
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="column1= case" suffix="end," >
                <foreach collection="list" item="item" index="index">
                    <if test="item.column1 != null">
                        when id = #{item.id} then #{item.column1}
                    </if>
                </foreach>
                else column1
            </trim>
            <trim prefix="column2 = case" suffix="end," >
                <foreach collection="list" item="item" index="index">
                    <if test="item.column2 != null">
                        when id = #{item.id} then #{item.column2}
                    </if>
                </foreach>
                else column2
            </trim>
        </trim>
        where
        <foreach collection="list" item="item" open="( " separator=") or (" close=" )">
            id = #{item.id}
        </foreach>

当解析 这句时, 执行CaseExpressionContext#simpleExpr() 会返回空指针异常

azraelee avatar May 26 '20 07:05 azraelee

what's the logic sql executed?

kimmking avatar May 26 '20 08:05 kimmking

For English only, other languages will not accept.

terrymanu avatar May 26 '20 16:05 terrymanu