google-code-export / nutz

Automatically exported from code.google.com/p/nutz
Apache License 2.0
1 stars 1 forks source link

字段中包含某些特殊字符的时候查询出错 #208

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
比如修改UpdateTest.java中的如下测试方法:
    @Test
    public void batch_update_relation() {
        dao.updateRelation( Fighter.class,
                            "base",
                            Chain.make("bname", "bl'ue"),------------原来是"blue",改成"bl'ue"
                            Cnd.where("bname", "=", "red"));
        assertEquals(13, dao.count("dao_m_base_fighter", Cnd.where("bname", "=", "bl'ue")));------------原来是"blue",
改成"bl'ue"
    }

2010-05-28 15:04:24,337 [main] DEBUG org.nutz.dao.impl.NutDao - UPDATE 
dao_m_base_fighter SET bname='bl'ue'  WHERE bname='red'
bname字段更新成bl'ue,包含“'”字符。

2010-05-28 15:05:02,021 [main] DEBUG org.nutz.dao.impl.NutDao - SELECT COUNT(*) 
FROM dao_m_base_fighter  WHERE bname='bl''ue'
查询的时候sql拼装的时候有问题,编程了bl''ue。看了代码,��
�要是拼装sql的时候对某几个特殊字符做了转移,导致查询失�
��。

Original issue reported on code.google.com by hzzd...@gmail.com on 28 May 2010 at 7:19

GoogleCodeExporter commented 9 years ago
保存的时候没有转义,但是查询的时候做了转义,所以出错��
�吧。

Original comment by hzzd...@gmail.com on 28 May 2010 at 7:55

GoogleCodeExporter commented 9 years ago

Original comment by zozoh...@gmail.com on 7 Jun 2010 at 4:43

GoogleCodeExporter commented 9 years ago
这个不应该早点解决吗??

Original comment by wendal1985@gmail.com on 26 Sep 2010 at 6:01