Is it a normal behavior that for queries with a LEFT OUTER JOIN, generated code does not give access to the custom mapper ?
Example :
select_news_with_picture_from_id:
SELECT *
FROM news
LEFT OUTER JOIN author ON news.authorId = author.id
WHERE
news.apiId = ?;
Generated code:
database.newsQueries.select_news_with_picture_from_id(newsId)
.asObservable()
.mapToOneNonNull()
are there more than 22 columns in the projection?
yes !
ha thats fun. There used to be a constraint on 22 parameters to a lambda but thats gone now.
I need this as well, I have "polymorphic" items, where all the fields of all subtypes are columns merged in one table
Any workaround?
not really, you have to use exposed method and map from the type given to you. I'll try and get a fix in for this before the next release.
Okay, that can work in meantime, thanks
Faced with the same issue on 1.1.3 (Android Driver), Kotlin 1.3.30
Any workaround for this?
no, we need the above issue fixed first
So is it related to Kotlin Native issue?
We are moving from SqlDelight 0.7.1 and SqlDelight 1.1.3 doesn't serve well in case if we have at least one JOIN (around 25 fields). That can't be simplified, unfortunately.
Do you know if possible to turn off needsLambda check only for Android driver inside sqldelight-compiler and publish it locally? I am stuck with the issue and can't figure out how to resolve it
> Could not create task ':messages:generateDebugDatabaseInterface'.
> com/intellij/openapi/fileTypes/LanguageFileType
> Could not create task ':smskit:generateDebugDatabaseInterface'.
> com/squareup/sqldelight/core/lang/SqlDelightFileType
Btw the workaround is to map the FooBar projection object to your DomainFooBar manually (so yea, garbage, but will do until fixed)
Yeah, this what came to my mind as well, the main issue that I have to do it for every generated interface, even if they have the same fields set.
Also another solution is to map SqlCursor manually, but obviously we can't use autogenerated mappers from SqlDelight and it doesn't make much sense to use Delight without it's main features.
if you are exposing the same fields from multiple queries you can use a view to have the interface be the same
@AlecStrong view require migrations though 馃槪
"Abitrary Arity" is the name of my punk rock band
It's now merged, I asked if it's possible to re-open the original PR
It's fixed in Kotlin 1.3.60, which is not released
Any updates on this?
This is fixed in Kotlin 1.3.60. This can prob be closed.
@benasher44 ,
But it's not fixed in SqlDelight (probably, this is the PR which can bring a fix: https://github.com/cashapp/sqldelight/pull/1232)
Here is a Test.sq:
CREATE TABLE dbTest(
field1 TEXT,
field2 TEXT,
field3 TEXT,
field4 TEXT,
field5 TEXT,
field6 TEXT,
field7 TEXT,
field8 TEXT,
field9 TEXT,
field10 TEXT,
field11 TEXT,
field12 TEXT,
field13 TEXT,
field14 TEXT,
field15 TEXT,
field16 TEXT,
field17 TEXT,
field18 TEXT,
field19 TEXT,
field20 TEXT,
field21 TEXT,
field22 TEXT
);
getTest:
SELECT * FROM dbTest;
and here is the generated TestQueries.kt:
interface TestQueries : Transacter {
fun <T : Any> getTest(mapper: (
field1: String?,
field2: String?,
field3: String?,
field4: String?,
field5: String?,
field6: String?,
field7: String?,
field8: String?,
field9: String?,
field10: String?,
field11: String?,
field12: String?,
field13: String?,
field14: String?,
field15: String?,
field16: String?,
field17: String?,
field18: String?,
field19: String?,
field20: String?,
field21: String?,
field22: String?
) -> T): Query<T>
fun getTest(): Query<DbTest>
}
However, if a 23rd parameter is added:
CREATE TABLE dbTest(
field1 TEXT,
field2 TEXT,
field3 TEXT,
field4 TEXT,
field5 TEXT,
field6 TEXT,
field7 TEXT,
field8 TEXT,
field9 TEXT,
field10 TEXT,
field11 TEXT,
field12 TEXT,
field13 TEXT,
field14 TEXT,
field15 TEXT,
field16 TEXT,
field17 TEXT,
field18 TEXT,
field19 TEXT,
field20 TEXT,
field21 TEXT,
field22 TEXT,
field23 TEXT
);
getTest:
SELECT * FROM dbTest;
there will be no method which takes a mapper generated:
interface TestQueries : Transacter {
fun getTest(): Query<DbTest>
}
Edit: tested on
SqlDelight 1.2.2
Kotlin 1.3.61
Oh dang. Didn't realize this still need SQLDelight changes.
Any chance it'll be fixed soon?
Most helpful comment
It's fixed in Kotlin 1.3.60, which is not released