获取具有包含大写字符的列名称的表的primay键时,Jooq的值无效

时间:2022-06-01 21:26:50

Given the following table in Sqlite:

给出Sqlite中的下表:

CREATE TABLE author (
    idOfAuthor   INTEGER (10) PRIMARY KEY,
    name TEXT (255) 
);

The method table.getPrimaryKey() returns an array of one element that is null. After changing the column name "idOfAuthor" to "id_of_author" it gets returned as expected.

方法table.getPrimaryKey()返回一个为null的元素的数组。将列名“idOfAuthor”更改为“id_of_author”后,将按预期返回。

Maybe the field(String name) method in org.jooq.impl.Fields class should use equalsIgnoreCase rather than just equals?

也许org.jooq.impl.Fields类中的字段(String name)方法应该使用equalsIgnoreCase而不是equals?

1 个解决方案

#1


0  

I suspect you're using the Xerial JDBC driver, which means you've run into this issue here:

我怀疑你正在使用Xerial JDBC驱动程序,这意味着你在这里遇到了这个问题:

https://bitbucket.org/xerial/sqlite-jdbc/issues/167/databasemetadatagetprimarykeys-reports

https://bitbucket.org/xerial/sqlite-jdbc/issues/167/databasemetadatagetprimarykeys-reports

There is a bug in the Xerial JDBC driver, which reports DatabaseMetaData.getPrimaryKeys() columns with all lower-case characters. This produces no primary key columns from jOOQ's Table.getPrimaryKey() call.

Xerial JDBC驱动程序中存在一个错误,它使用所有小写字符报告DatabaseMetaData.getPrimaryKeys()列。这不会从jOOQ的Table.getPrimaryKey()调用中生成主键列。

jOOQ's org.jooq.Meta uses JDBC DatabaseMetaData behind the scenes, and thus suffers from this problem indirectly, which could also be considered a bug (#5097), which should be fixed soon.

jOOQ的org.jooq.Meta在幕后使用JDBC DatabaseMetaData,因此间接地遇到了这个问题,这也可以被认为是一个错误(#5097),应尽快修复。

#1


0  

I suspect you're using the Xerial JDBC driver, which means you've run into this issue here:

我怀疑你正在使用Xerial JDBC驱动程序,这意味着你在这里遇到了这个问题:

https://bitbucket.org/xerial/sqlite-jdbc/issues/167/databasemetadatagetprimarykeys-reports

https://bitbucket.org/xerial/sqlite-jdbc/issues/167/databasemetadatagetprimarykeys-reports

There is a bug in the Xerial JDBC driver, which reports DatabaseMetaData.getPrimaryKeys() columns with all lower-case characters. This produces no primary key columns from jOOQ's Table.getPrimaryKey() call.

Xerial JDBC驱动程序中存在一个错误,它使用所有小写字符报告DatabaseMetaData.getPrimaryKeys()列。这不会从jOOQ的Table.getPrimaryKey()调用中生成主键列。

jOOQ's org.jooq.Meta uses JDBC DatabaseMetaData behind the scenes, and thus suffers from this problem indirectly, which could also be considered a bug (#5097), which should be fixed soon.

jOOQ的org.jooq.Meta在幕后使用JDBC DatabaseMetaData,因此间接地遇到了这个问题,这也可以被认为是一个错误(#5097),应尽快修复。