How can I dynamically join tables in SQLDelight???
For Example, if i have a table like
Copy code
| id | referenceId | referenceType |
And according to the referenceType, i have to join on some specific table,
Also making sure, that any change in that child table emits the change when i query this table using
asFlow()
or return
PagingData
k
kevin.cianfarini
02/19/2024, 6:36 PM
Copy code
if (someCondition) {
queryTableJoinedOnTable1()
} else {
queryTableJoinedOnTable2()
}
kevin.cianfarini
02/19/2024, 6:37 PM
SQLDelight registers change listeners for every table possibly involved in a query, so even though they'd be two separate queries they would each still emit changes when something has potentially changed in the table
v
Vaibhav Jaiswal
02/20/2024, 7:06 AM
Thanks,
I'll try this out
Vaibhav Jaiswal
02/20/2024, 1:10 PM
@kevin.cianfarini any way to do it via kotlin and not
JOIN
in SQL
The problem with join is that, there are too many columns returned and mapping it correctly to a sealed class is becoming a pain