简体   繁体   中英

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. Using jOOQ, I didn't found a correct method to query a column, ignoring its case sensitivity. Looking at here : jOOQ TableField Method , I can see that there's equalIgnoreCase . But in the jooq class itself, that method is not there.

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() . 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. The relevant setting is RenderNameStyle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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