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

关于Record更新表记录 #1294

Closed
threefish opened this Issue Aug 1, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@threefish
Contributor

threefish commented Aug 1, 2017

发现一个关于Record更新问题,不知道是否是bug
代码1(正确生成:UPDATE ts SET test='123444' WHERE uuid=1)

List<Record> list = new ArrayList<>();
        Record r = new Record();
        r.put(".table", "ts");
        r.set("+id", 1);
        r.set("test", "123444");
        list.add(r);
        dao.update(list);

代码2(生成:UPDATE ts SET test='123444' 丢失了where 条件)

List<Record> list = new ArrayList<>();
       Record r = new Record();
       r.put(".table", "ts");
       r.set("+id", "1");
       r.set("test", "123444");
       list.add(r);
       dao.update(list);

请注意代码2中的+id是字符串类型,在代码1中是int

@wendal

This comment has been minimized.

Show comment
Hide comment
@wendal

wendal Aug 1, 2017

Member

+ 自增
! 非空
* 主键

所以, 上面代码中的加号应全部换成星号

Member

wendal commented Aug 1, 2017

+ 自增
! 非空
* 主键

所以, 上面代码中的加号应全部换成星号

@wendal wendal closed this Aug 1, 2017

@threefish

This comment has been minimized.

Show comment
Hide comment
@threefish

threefish Aug 1, 2017

Contributor

明白了

Contributor

threefish commented Aug 1, 2017

明白了

@wendal wendal added the FAQ label Aug 1, 2017

@wendal

This comment has been minimized.

Show comment
Hide comment
@wendal

wendal Apr 1, 2018

Member
    @Test
    public void test_issue_1294() {
        dao.clear(Pet.class);
        dao.insert(Pet.create("wendal"));
        Record re = new Record();
        re.put(".table", "t_pet");
        re.put("*name", "wendal");
        re.put("age", 30);
        dao.update(re, Cnd.where("age", ">", -100));
    }
Member

wendal commented Apr 1, 2018

    @Test
    public void test_issue_1294() {
        dao.clear(Pet.class);
        dao.insert(Pet.create("wendal"));
        Record re = new Record();
        re.put(".table", "t_pet");
        re.put("*name", "wendal");
        re.put("age", 30);
        dao.update(re, Cnd.where("age", ">", -100));
    }

wendal added a commit that referenced this issue Apr 1, 2018

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