简体   繁体   English

如何使用Jooq查询不区分大小写的列?

[英]How to use Jooq to query for a column case-insensitive?

I am using jOOQ with PostgreSQL, and I just realize that my column is case sensitive. 我正在使用带有PostgreSQL的jOOQ,我只是意识到我的列是区分大小写的。 Using jOOQ, I didn't found a correct method to query a column, ignoring its case sensitivity. 使用jOOQ,我没有找到一个正确的查询列的方法,忽略了它的区分大小写。 Looking at here : jOOQ TableField Method , I can see that there's equalIgnoreCase . 看看这里: jOOQ TableField方法 ,我可以看到有equalIgnoreCase But in the jooq class itself, that method is not there. 但是在jooq类中,那种方法并不存在。

Does anybody know what did I do wrong here? 有谁知道我在这里做错了什么?

I'm not quite sure if by "case sensitivity", you mean the column content, or the column name. 我不太确定“区分大小写”是指列内容还是列名。

  • If you mean the column content, then you found the right method: Field.equalIgnoreCase() . 如果您的意思是列内容,那么您找到了正确的方法: Field.equalIgnoreCase() A usage example: 一个用法示例:

     create.select() .from(MY_TABLE) .where(MY_TABLE.MY_FIELD.equalIgnoreCase("abc")) .fetch(); 
  • If, however, you mean the column name, then you can use the Factory Settings to control how jOOQ renders field and column names. 但是,如果您指的是列名,则可以使用“ Factory Settings来控制jOOQ如何呈现字段和列名称。 The relevant setting is RenderNameStyle 相关设置为RenderNameStyle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM