DBFlow icon indicating copy to clipboard operation
DBFlow copied to clipboard

SQL query is not created properly if foreignKey is reference to a table with multiple primaryKey

Open punnyaannjoy opened this issue 1 year ago • 3 comments

Wrong SQL query is generated when parent table having more than one primary key is referenced through foreign key in the child table

DBFlow Version: 4.2.4

Bug or Feature Request: Fix the logic for creating SQL query when Parent table with more than 1 primary key is referenced through foreignKey in the child table

Description:

When a child table reference a parent table (having more than one primaryKey) through Foreign Key, the SQL query generated for the child table is wrong

Here is the example of the query generated for UPDATE operation.

@Override
public final String getUpdateStatementQuery() {
 return "UPDATE ContactPhoneMapping SET contact_primaryId=?,contact_secondaryId=?,phoneNo=?,type=? WHERE contact_primaryId=?,contact_secondaryId=? AND phoneNo=?";
}


Notice that "AND" is missing in the where condition for "contact_primaryId" and "contact_secondaryId"

punnyaannjoy avatar Jun 14 '24 03:06 punnyaannjoy

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

loquitowen avatar Jun 14 '24 03:06 loquitowen

@agrosner any suggestion on the above issue?

punnyaannjoy avatar Jul 10 '24 05:07 punnyaannjoy

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

loquitowen avatar Jul 10 '24 05:07 loquitowen