Skip to content
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

生成插入sql语句的建议 #61

Open
activepirate opened this issue Dec 2, 2020 · 1 comment
Open

生成插入sql语句的建议 #61

activepirate opened this issue Dec 2, 2020 · 1 comment
Labels
question Further information is requested

Comments

@activepirate
Copy link
Collaborator

activepirate commented Dec 2, 2020

现在生成的sql语句,对于没有赋值的属性,插入null
这样对clickhouse数据库不太友好,clickhouse的字段类型为Nullable(typename)类型,才能插入null,Nullable(typename)
如果生成的sql语句,没有插入null值,对clickhouse友好些
1.4.0版本保存数据:

Member newMember = new Member();
newMember.setNo("100000")
        .setName("Pamela")
        .setGender(1)
        .setRegisteredAtWithJoda(DateTime.now())
        .setUpdatedAt(Timestamp.valueOf("2020-10-05 00:00:00"))
        .setMobile("15011112222");

Member member = Member.create(newMember, true);

1.4.0版本生成sql信息:

信息: [109ms] INSERT INTO `members` (`no`,`name`,`gender`,`mobile`,`extended_attributes`,`registered_at`,`updated_at`) 
VALUES (?,?,?,?,?,?,?), with: [100000,Pamela,1,15011112222,null,2020-12-02 19:54:18.157,2020-10-05 00:00:00.0]
@catchex
Copy link
Member

catchex commented Dec 2, 2020

这应该对数据库的类型设置为Nullable, 而不应该由程序去控制。

@catchex catchex added the question Further information is requested label Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants