You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method DatabaseMetaData#getImportedKeys() reports empty string for the FK_NAME column when the foreign key was created using a quoted form such as:
The problem is the regular expression FK_NAMED_PATTERN in src/main/java/org/sqlite/jdbc3/JDBC3DatabaseMetaData.java that do not take into account the optional "" arround the foreign key name, which is "REFERENCEDENTITY_94OR1OTBGSDVTRJCVZ6OWAPZR_FK" in this example.
This fix on the regex resolve the issue:
--- a/src/main/java/org/sqlite/jdbc3/JDBC3DatabaseMetaData.java+++ b/src/main/java/org/sqlite/jdbc3/JDBC3DatabaseMetaData.java@@ -2067,7 +2067,7 @@ public abstract class JDBC3DatabaseMetaData extends org.sqlite.core.CoreDatabase
* Pattern used to extract a named primary key.
*/
private final Pattern FK_NAMED_PATTERN =
- Pattern.compile("CONSTRAINT\\s*([A-Za-z_][A-Za-z\\d_]*)?\\s*FOREIGN\\s+KEY\\s*\\((.*?)\\)",+ Pattern.compile("CONSTRAINT\\s*\"?([A-Za-z_][A-Za-z\\d_]*)?\"?\\s*FOREIGN\\s+KEY\\s*\\((.*?)\\)",
Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
private String fkTableName;
Maybe a similar issue occurs with PK_NAMED_PATTERN and getPrimaryKeys() .
Kind regards,
Cédric.
The text was updated successfully, but these errors were encountered:
Hi,
The method DatabaseMetaData#getImportedKeys() reports empty string for the FK_NAME column when the foreign key was created using a quoted form such as:
CREATE TABLE "MAIN"."REFERENCEDENTITY" ("ID" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"ENUMSTRCOL" TEXT, CONSTRAINT "REFERENCEDENTITY_94OR1OTBGSDVTRJCVZ6OWAPZR_FK" FOREIGN KEY ("ENUMSTRCOL") REFERENCES "TESTINGENUM" ("NAME"))
The problem is the regular expression FK_NAMED_PATTERN in src/main/java/org/sqlite/jdbc3/JDBC3DatabaseMetaData.java that do not take into account the optional "" arround the foreign key name, which is "REFERENCEDENTITY_94OR1OTBGSDVTRJCVZ6OWAPZR_FK" in this example.
This fix on the regex resolve the issue:
Maybe a similar issue occurs with PK_NAMED_PATTERN and getPrimaryKeys() .
Kind regards,
Cédric.
The text was updated successfully, but these errors were encountered: